Resizing Tif's to smaller gifs adds pixels

S

smullen.uclick

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 question.

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)
newimg.save("tmsho20080901.gif")

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top