RANSOM DEMAND: Image Held Hostage!
Chris Gonnerman
chris.gonnerman at newcenturycomputers.net
Sun Nov 18 14:24:33 EST 2001
----- Original Message -----
From: "Ben Ocean" <zope at thewebsons.com>
> I need a way to size up images via script. Now, in that inferior scripting
> language known as PHP, *they* have such a tool: getimagesize().
When you say "size up" you mean to retrieve the image dimensions? All this
time I thought you wanted to *resize* the images!
> Can it be
> that God's gift to scripting languages, Python, can't compete here? If
it's
> true that PHP has one up on us here, how can I write a script that bridges
> this dastardly gap?
There are two options that come to mind... the Pythonware Imaging Library
at pythonware.com, and the GDmodule (which I currently maintain) at
http://newcenturycomputers.net/projects/gdmodule.html
Using GDmodule, you'd say
import gd
img = gd.image("filename.goes.here.jpg")
print img.size()
to print the tuple of (x,y) dimensions of the picture.
Actually changing the size would be harder, requiring allocation of a new
empty image of the correct size, followed by using the img.copyResizedTo()
method.
More information about the Python-list
mailing list