[Image-SIG] pil rotate 90 bug ?

Edward Cannon cannon.el at gmail.com
Thu Aug 4 22:38:21 CEST 2011


A possible workaround is to convert the images to some more standard format ie im.convert("rgb"). If you need to rotate by multiples of 90 the transform method works and is faster. 



On Aug 4, 2011, at 1:24 PM, Guilherme Polo <ggpolo at gmail.com> wrote:

> 2011/7/28 Jeremy Craven <c.j.craven at sheffield.ac.uk>:
>> I have a program that has been working fine rotating images by arbitrary
>> angles.
>> 
>> I just found that if I specify 90 degrees exactly then the image goes crazy:
>> only appears in left hand half of image and every other line is black and
>> image is stretched vertically.
>> 
>> Any ideas if this is a bug or I am perhaps doing something in a
>> non-recommended way.
>> 
> 
> It is a bug, it doesn't rotate the image by 90 degrees.
> 
> Looking through PIL code, I would think the problem is that you have
> these "special images" with mode as "I;16B", which PIL marks as
> IMAGING_TYPE_SPECIAL. The code paths used for such special things
> probably are under tested.
> 
>> I attach a cut down version of the code which shows the problem. It reads
>> "test_in.tif". It rotates it 90.0 and writes "test.tif". It rotates it 89.99
>> and writes "test1.tif". The second output file looks fine. The first is
>> wonky.
>> 
>> I'm using version 1.1.7
>> 
>> Thanks for listening
>> 
>> Jeremy
>> 
>> --
>> *********************************************************************************
>> 
>> Dr C. Jeremy Craven
>> Department of Molecular Biology and Biotechnology
>> University of Sheffield,
>> Firth Court, Western Bank
>> S10 2TN Sheffield UK
> 
> 
> 
> -- 
> -- Guilherme H. Polo Goncalves
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig


More information about the Image-SIG mailing list