469,286 Members | 2,498 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,286 developers. It's quick & easy.

Automated resizing of JPEG image + making slices?

Hello everybody.

I'm currently involved in a site building project in which we're
going to use the Google Maps API. The user will be able to browse the
site by looking over a really large image, similar to how Google Maps
itself works, except with the design of the site on the background
rather than a map of the world.

I initially hired someone to do it in PHP (don't bite, please :-) but
it seems that I forgot about one thing: the people updating the site
would have been able to upload a huge 30 MB JPEG image, which PHP
would then resize to various sizes and cut them into 200x200 pieces,
which would be fed to the Google Maps API. However, this costs a lot
of memory, and PHP by default only has 8 MB.

The programmer offered to do a C++ image manipulator, but he uses
Windows and the people who update the site use Mac OS X. It would be
tedious. Then I thought that Python might solve me the head-ache.

I know some Python (but not much since I've never actually written
that many things in it), and with some effort I could probably make a
simple image manipulator frontend in it, but only if I can find a
good library for doing the actual manipulation. Do any of you know
such libraries?

Many thanks,

Michiel Sikma
mi*****@thingmajig.org


Feb 15 '07 #1
2 1651
Michiel Sikma <mi*****@thingmajig.orgwrites:
I know some Python (but not much since I've never actually written
that many things in it), and with some effort I could probably make a
simple image manipulator frontend in it, but only if I can find a
good library for doing the actual manipulation. Do any of you know
such libraries?
Search for "Python Imaging Library".
Feb 15 '07 #2
Michiel Sikma wrote this on Thu, 15 Feb 2007 22:21:34 +0100. My reply
is below.

-snip-
I initially hired someone to do it in PHP (don't bite, please :-)
but it seems that I forgot about one thing: the people updating the
site would have been able to upload a huge 30 MB JPEG image, which
PHP would then resize to various sizes and cut them into 200x200
pieces, which would be fed to the Google Maps API. However, this
costs a lot of memory, and PHP by default only has 8 MB.
-snip-
I know some Python (but not much since I've never actually written
that many things in it), and with some effort I could probably make
a simple image manipulator frontend in it, but only if I can find a
good library for doing the actual manipulation. Do any of you know
such libraries?
I can't make head or tail of your project's constraints, so the
following advice probably isn't worth much.

IMHO, slicing and dicing is best done by stand-alone, special-purpose,
image-manipulation routines that do their own I/O. Here is a library
of such routines:

o http://netpbm.sourceforge.net/doc/directory.html

These can be chained together (piped) in shell script (or in *python*
if you prefer) if they're installed on your server. There is an API
(and maybe even a *python* interface), but I've never needed it. For
security, the parameters passed to these routines from the wild (such
as file names) need to be scrubbed clean of any delimiters that would
look like executable shell script code, variable substitutions, or
even spurious path names.

--
... Chuck Rhode, Sheboygan, WI, USA
... Weather: http://LacusVeris.com/WX
... 18° — Wind WNW 13 mph
Feb 15 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by lawrence | last post: by
2 posts views Thread by Clyde Ellul | last post: by
reply views Thread by E | last post: by
reply views Thread by E | last post: by
4 posts views Thread by CodeRazor | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.