[Image-SIG] problem with tiff image in PIL

Hans-Erik Andersen hanserik14411 at gmail.com
Fri Oct 21 22:19:57 CEST 2011


I'm having a problem with opening a TIF image in PIL, rotating it, and then
converting it to a string for use in PyOpenGL. This is the Python code:

im1 = open("c:\image.TIF")
im2 = im1.transpose(ROTATE_90)
im3 = im2.tostring("raw", "RGB", 0, -1)

When I display the rotated image using the PIL show() function (immediately
after the rotation is applied) it looks OK. However, when I convert the
image to a string and display it elsewhere, it appears diagonally warped,
although the colors are OK. If I do not rotate the image, then it looks OK
after the "tostring" conversion. So, it seems that the
"transpose(ROTATE_90)" function is doing something to the image that is not
evident until it is converted to a string... I'm completely baffled.
FYI - I've checked the mode of the image after opening it and it is "RGB"

Thanks for the help!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20111021/0c7b5897/attachment.html>


More information about the Image-SIG mailing list