[Image-SIG] Adding endianess support in PIL
Pierre Barbier de Reuille
Pierre.Barbier_de_Reuille at inria.fr
Mon Sep 25 06:55:38 CEST 2006
Steve Holden a écrit :
> Pierre Barbier de Reuille wrote:
>> First, AFAIK, there is no endianess support in PIL. But if there is,
>> please tell me and forget about this mail.
>> The problem in dealing with >8bits per channel images is the endianess
>> become important. However, there is, for now, no way of knowing the
>> endianess (unless you know a way specific to the format, as in the TIFF
>> tags). So I propose to add a "byteorder" attribute (similar to the NumPy
>> one) with the following values : '|' for "doesn't matter" (i.e. 8 bits
>> per channel or less), '>' for "big endian" and '<' for "little endian".
>> These values are taken from the NumPy lib. I don't know PIL enough to
>> propose a patch or anything, but this would be, IMHO, a useful and quite
>> easy addition to PIL.
> Given that PIL doesn't appear to have endianness issues (which is to
> say that the package already correctly adjusts to the endianness of
> its platform) I'm not sure quite what this is supposed to buy.
Well, what version are you referring to ? Because when I load 16-bits
TIFF images with PIL and convert them to NumPy (using thee tostring
method of the image), the result is not the same if the image was little
endian or big endian. So maybe PIL, internally, knows which endianess is
used and output correct values, but when converting to/from NumPy, as
this value is not accessible, it becomes a problem ... isn't it ?
> In other words, let's just forget you ever said this ;-)
More information about the Image-SIG