Image rotation issue

Ian Kelly ian.g.kelly at gmail.com
Mon Mar 30 17:32:18 EDT 2015


On Mon, Mar 30, 2015 at 3:22 PM,  <kai.peters at gmail.com> wrote:
> rotimg = img.rotate(270) # rotation is counterclockwise
>
> # i can almost make it work by resizing rotimg here, but the aspect ratio is then screwed
> #rotimg = rotimg.resize((1024, 1280))
>
> rotimg.show()
> imagedata = list(rotimg.getdata())
>
> But grabbing data from the rotimg does not work as it does not seem to return an image with swapped dimensions...
>
> What am I missing?

Have you tried passing the expand flag to rotate?

http://pillow.readthedocs.org/en/latest/reference/Image.html#PIL.Image.Image.rotate

I'm not sure if that will result in an image sized (1280, 1024) or
(1280, 1280). If the latter, you should be able to fix it using
Image.crop.



More information about the Python-list mailing list