[Image-SIG] Resizing Tif's to smaller gifs adds pixels
Laura & Edward Cannon
cannon.el at gmail.com
Wed Oct 22 17:12:44 CEST 2008
Your problem is that you resized the image twice. Use either the thumbnail
method or the resize method, not both. (personally I would use resize)
2008/10/21 Samuel Mullen <smullen at uclick.com>
> I'm not entirely sure how this group works: if there is a page I'm supposed
> to follow up on or if I should expect an email in reply. Anyway, here's my
> I'm very new to Python and PIL, I know how to do this stuff in perl and
> ImageMagick, but I'm having issues with Python and PIL.
> I need to scale a TIFF image from 1925x588 px to a GIF of 600xnnn px.
> I've tried the following code, but it leads to a lot of extra odd colored
> pixels being inserted into the resulting image.
> img = "tmp/tmsho20080901.tif"
> im = Image.open("tmp/tmsho20080901.tif")
> w, h = im.size
> im.thumbnail((600, h * 600 / w), Image.ANTIALIAS)
> newimg = im.resize((600, int(h * (600.0 / w))), Image.ANTIALIAS)
> Using ImageMagick's convert I would do this...
> convert -colors 256 -resize 600 -colorspace RGB -black-threshold 100
> -contrast -intent Perceptual tmp/tmsho20080901.tif tmsho20080901.gif
> I think it may have something to do with the palette or the number of
> colors alotted for the resulting image, but I'm really not a graphics guy.
> Any help on this would be appreciated.
> Samuel Mullen
> Image-SIG maillist - Image-SIG at python.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Image-SIG