Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #88350

Re: Image rotation issue

References <baa02843-6a54-440d-a404-552af28c5816@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2015-03-30 15:32 -0600
Subject Re: Image rotation issue
Newsgroups comp.lang.python
Message-ID <mailman.350.1427751181.10327.python-list@python.org> (permalink)

Show all headers | View raw


On Mon, Mar 30, 2015 at 3:22 PM,  <kai.peters@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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Image rotation issue kai.peters@gmail.com - 2015-03-30 14:22 -0700
  Re: Image rotation issue Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-30 15:32 -0600
  Re: Image rotation issue Chris Angelico <rosuav@gmail.com> - 2015-03-31 10:47 +1100
    Re: Image rotation issue high5storage@gmail.com - 2015-03-30 21:04 -0700
      Re: Image rotation issue Chris Angelico <rosuav@gmail.com> - 2015-03-31 15:09 +1100

csiph-web