[Image-SIG] What does the 'F' mode mean in PIL?

Christopher Barker Chris.Barker at noaa.gov
Thu Jun 16 20:06:59 CEST 2011


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


More information about the Image-SIG mailing list