You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: tobytes() byteorder with multibyte samples, bigendian #385
Long story: The problem is that the test image 12bit.cropped.tif is a tiff image with data stored in little-endian format and 16bit samples. Now, Image.tobytes() (which is called when doing numpy.array(img)) returns the raw data, without byteswapping. This means that i.e.
returns '\xe0\x01' on both big- and little-endian platforms, which corresponds (correctly) to 480 on little-endian, but on big-endian it corresponds to 57345.
FIxing the issue itself should not be too much trouble, the main issue is where to fix it.
Some possibilities (without very in-depth study of the code):
The test is wrong. tobytes() returns the raw data, and if that appens to be in little-endian format, then it is up to the user to handle this.
TiffDecode should byteswap if the endianness of the image data differs from the platform endinanness.
I think the decoder should be putting the bytes into native order, i.e. what we get out of the tiff decoder should always be a I;16N rawmode, no matter if it's a II or MM tiff. I'd bet the libtiff decoder already does this.
On the other hand, I wouldn't bet against the test being wrong, as I didn't test it against a big endian machine. Time to fire up the old mini I guess.
I'll dig some on this. (oh, it would be nice if there was documentation of what the in memory bits and assumptions were supposed to be. I'm so sure I've been over this before)
I've been granted access to a ppc64 cluster by a Fedora contributor. If you post your public ssh key and give a username, I can see whether they can give you access also.
I tried with qemu a while back, little success (if memory serves me right, there was some major component not fully working for ppc back then, and possibly still).
My standard estimation on the qemu approach is that it's a day of chasing dependencies. (based on no one giving detailed directions for it working out of the box).
I'm on ubuntu for a host os, and after tracking down an openbios and mucking with the network configuration, I've got a black screen and 100% processor usage. for 15 minutes. It's either glacial or broken. Hopefully your guy will come through.
Activity
wiredfool commentedon Oct 18, 2013
(recognizing my code there...)
I think the decoder should be putting the bytes into native order, i.e. what we get out of the tiff decoder should always be a I;16N rawmode, no matter if it's a II or MM tiff. I'd bet the libtiff decoder already does this.
On the other hand, I wouldn't bet against the test being wrong, as I didn't test it against a big endian machine. Time to fire up the old mini I guess.
I'll dig some on this. (oh, it would be nice if there was documentation of what the in memory bits and assumptions were supposed to be. I'm so sure I've been over this before)
wiredfool commentedon Oct 18, 2013
Are there any places to get a bigendian virtual machine to test against?
manisandro commentedon Oct 18, 2013
I've been granted access to a ppc64 cluster by a Fedora contributor. If you post your public ssh key and give a username, I can see whether they can give you access also.
wiredfool commentedon Oct 18, 2013
Thanks, wiredfool works as a username.
https://gist.github.com/wiredfool/c441e27403d09239a0e9
A little googling led to qemu + a ppc distro + mucking about as well, so there may be a plan b.
manisandro commentedon Oct 18, 2013
Request posted https://bugzilla.redhat.com/show_bug.cgi?id=1019656#c4
I tried with qemu a while back, little success (if memory serves me right, there was some major component not fully working for ppc back then, and possibly still).
wiredfool commentedon Oct 18, 2013
Thanks for the account request.
My standard estimation on the qemu approach is that it's a day of chasing dependencies. (based on no one giving detailed directions for it working out of the box).
manisandro commentedon Oct 18, 2013
Dependency-wise it's pretty ok on Fedora, just
# yum install qemuand then grab a ppc iso (i.e. from http://mirrors.fedoraproject.org/publiclist/Fedora/19/ppc/) and thenLast time I only saw a yellow screen, but now something actually seems to happen (albeit very slow).
wiredfool commentedon Oct 18, 2013
I'm on ubuntu for a host os, and after tracking down an openbios and mucking with the network configuration, I've got a black screen and 100% processor usage. for 15 minutes. It's either glacial or broken. Hopefully your guy will come through.
gustavold commentedon Oct 18, 2013
wiredfool, please try ssh chinook.fedora.osuosl.org and let me know if you have any problem logging in.
wiredfool commentedon Oct 18, 2013
that would be @gustavold , it's asking for a pw. sorry gustavoid.
gustavold commentedon Oct 18, 2013
Oh, sorry. I think it was a file permissions issue. Try again, please.
wiredfool commentedon Oct 18, 2013
Still not working.
gustavold commentedon Oct 18, 2013
My bad. It is working now. Sorry about that.
wiredfool commentedon Oct 18, 2013
\o/
wiredfool commentedon Oct 19, 2013
Ok, I've got Pillow built with enough libraries to replicate this on chinook.
My understanding at this point is:
\x01\xe0wiredfool commentedon Oct 21, 2013
More understanding:
I'm keeping this in my bigendian branch: https://github.com/wiredfool/Pillow/tree/bigendian
Merge pull request python-pillow#385 from radarhere/pypy310