[Image-SIG] What does the 'F' mode mean in PIL?
Christopher Barker
Chris.Barker at noaa.gov
Fri Jun 17 21:30:08 CEST 2011
A followup, trying to do something real
It seems that the raw decoder doesn't understand all the modes listed in:
http://www.pythonware.com/library/pil/handbook/decoder.htm
indeed, hardly any of them ('F' only for the "floating point modes")
Enclosed is some sample code I've got that attempts to convert a
unsigned 16 bit grayscale image to RGB. I can't get it to do anything,
as I get:
ValueError: unknown raw mode
for any floating point mode other than 'F'
What am I missing here?
-Chirs
Christopher Barker wrote:
> Hi folks,
>
> I've been looking through the docs on File Decoders (or, in my case for
> decoding binary data with fromstring() or frombuffer()):
>
> http://www.pythonware.com/library/pil/handbook/decoder.htm
>
> With the raw decoder, most of the modes are clear to me, but the 'F'
> mode has me confused:
>
> What is it really storing, working with?
> - one floating point value per pixel?
> - one floating point value per colorband?
> - but then, how are they arranged?
> - Is it single precision (32 bit) floats only?
>
>
> What does it mean if you use one of the modified 'F' modes, like
> "F;16N"? I know what an 16 bit native unsigned integer is, but I don't
> understand:
>
> - What happens if I do fromstring() with a mode f "F;16N" ?
> - is the data converted to a float (32bit)?
> - if so, do you just lose information if you have higher precision
> types being passed in?
> - is the raw data stored in 16 bit (two byte) chunks?
>
>
> - How is 'F' mode interpreted if you convert to, say 'RGB' mode?
> -grayscale?
> - something else?
>
>
> Any enlightenment would be great.
>
> -Chris
>
>
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PIL_u16.py
Type: application/x-python
Size: 812 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/image-sig/attachments/20110617/aed433dc/attachment.bin>
More information about the Image-SIG
mailing list