16bit RGB with Image module
Will McGugan
will at willNOmcguganSPAM.com
Tue Mar 27 15:19:59 EDT 2007
Jason B wrote:
> Well I kept screwing around and funny thing, this works:
>
> import sys, Image
>
> if len(sys.argv) == 2:
> print "\nReading: "+sys.argv[1]
> image_file = open(sys.argv[1], "rb")
> pixel_data = image_file.read()
>
> im = Image.fromstring("RGB", (326, 325), pixel_data, "raw", "BGR;16")
> im.show()
>
> Although I have no idea *why* it works, other than the fact that I'm now
> using the correct number of bits per pixel. :)
>
> Anyone have thoughts on this?
Well RGB will will use 24 bits per pixel, not 16, so the first error you
got makes sense. I guess using the raw decoder with "BGR;16" makes it
use 16 bit. Although, I couldn't find any reference in the docs!
I'm sure Fredrik Lundh could shed some light on this...
Will McGugan
--
blog: http://www.willmcgugan.com
More information about the Python-list
mailing list