Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.121 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.78; '*S*': 0.03; 'sized': 0.07; '1024)': 0.16; 'latter,': 0.16; 'missing?': 0.16; 'resizing': 0.16; 'rotation': 0.16; 'subject:issue': 0.16; 'fix': 0.17; 'wrote:': 0.18; 'passing': 0.19; 'aspect': 0.24; 'mon,': 0.24; 'header:In- Reply-To:1': 0.27; 'tried': 0.27; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'but': 0.35; 'received:google.com': 0.35; 'url:org': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; '30,': 0.65; 'mar': 0.68; '2015': 0.84; 'grabbing': 0.84; 'url:reference': 0.84; 'ratio': 0.91; 'url:image': 0.91; 'url:latest': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=ynTLj3w+s+A7pq8xE4SKGT1TYLP7ctdYnRNVoJDULYQ=; b=vC/ZXpTPp9X8Gyy9VIKr+eC+A8WF+rZv0W/n45WYg48ELMFd+SUQv9L9JmbrAXRtLf BtnRUdhE2saupQKzovMF0ym9kiovrPJhKTFtJAOo3rZ6+ZFSjiIo9uT9yly2cLep+s6I dkZfAJoLCKPDKyi5E7DzqGczIZUhTqRVkOttip6zTSBjr7mU2FawJf1AiaEKKWUDbrpM hXSrUYzEmaMgZKtDFdPn7mBnDalpbCGUKbWLS8qyDt9ZD1YeRefUTCl0yS/dFUK/yaI+ UUJr+jOhj55qMEXaX0sAtZl9g0yi772cyuro0TK8oIsmyX37J5hNbalETZp9o6JjFMEM 6Uzw== X-Received: by 10.66.172.4 with SMTP id ay4mr20840926pac.157.1427751179116; Mon, 30 Mar 2015 14:32:59 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Mon, 30 Mar 2015 15:32:18 -0600 Subject: Re: Image rotation issue To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1427751181 news.xs4all.nl 2883 [2001:888:2000:d::a6]:36129 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:88350 On Mon, Mar 30, 2015 at 3:22 PM, 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.