[Image-SIG] SystemError: tile cannot extend outside image

Jim Tittsler jwt at OnJapan.net
Sun Mar 20 04:13:07 CET 2005


On Sun, Mar 20, 2005 at 02:42:14AM +0100, Christian Heimes wrote:
> I've an issue with GIF and maybe other images with extrem ratio. The 
> attached gif file has a ration of 300x15 pixels and file resizing.
[...]
> target size:
>   16 x 16

Since image.thumbnail tries to preserve aspect ratio and uses
integer division, your thumbnail ends up being 16x0.

You could modify PIL to stay away from this degenerate
condition by adding y=max(1,y) and x=max(1,y) rules to the
aspect ratio calculation in Image.py.  But I'd think you might
be better served using image.transform and *not* attempting to
maintain the aspect ratio in cases like this.  Is a 1 pixel
high thumbnail useful? 

-- 
Jim Tittsler, Mitaka, Tokyo  http://www.OnJapan.net/      GPG: 0x01159DB6
Python Starship              http://Starship.Python.net/crew/jwt/
Ringo MUG Tokyo              http://www.ringo.net/rss.html



More information about the Image-SIG mailing list