Welcome to WebmasterWorld Guest from 54.166.112.74

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

Perl and images

Can perl manipulate images?

   
2:50 pm on Jun 16, 2004 (gmt 0)

10+ Year Member



Hello.
I have, as usual, a question.

Can perl manipulate images? Specifically, could I make a perl script where people upload images into a database and then the database script automatically renames the image and makes a corresponding thumbnail?

Any suggestions will be appreciated.

Thanks.

2:52 pm on Jun 16, 2004 (gmt 0)

10+ Year Member



P.S. I should have mentioned that I ask about Perl because that's the only language I (kind of) know. I could probably work with something else, but I'm basically clueless on anything except Perl and I don't, obviously, know that too well.

Again, thanks in advance.

3:01 pm on Jun 16, 2004 (gmt 0)

WebmasterWorld Senior Member drdoc is a WebmasterWorld Top Contributor of All Time 10+ Year Member



It sure can! The easiest approach is to use Perl in combination with the GD library [boutell.com]
8:37 pm on Jun 16, 2004 (gmt 0)

10+ Year Member



Check out Image::Thumbnail or Image::GD::Thumbnail to help you with this.

[search.cpan.org...]

1:31 pm on Jun 17, 2004 (gmt 0)

10+ Year Member



Image::Magick is another good one, there are perl bindings on CPAN, or just use the convert executable.

Sean

5:42 pm on Jun 17, 2004 (gmt 0)

10+ Year Member



Wow, lots of stuff to look through.

It'll take me a while to figure out how to use it, but that (DBŠImageMagick) is definitely what I need.

Thanks all!

8:03 pm on Jun 17, 2004 (gmt 0)

10+ Year Member



Checkout imagemagick/perlmagick. I'm using this right now to create thumbnails and automatically tag information from a form right on to the image (like submitter info).

Only problem I've seen is between different version of perl and/or imagemagick. For some reason when I moved the same perl program to another machine the tagging jumped by about 10 pixel in relation to the image. Spent a long time trying to figure it out... and failed. I ended up just added code to change the positioning by 10 pixels. :)

9:11 pm on Jun 18, 2004 (gmt 0)

10+ Year Member



I know this is a Perl forum, but you seemed to indicate that you only ask about Perl because that's what you know. If you do Perl, you would probably find yourself very comfortable in the PHP arena.

As to the othe suggestions, my first thought as well was to use image::magick

9:56 am on Jul 18, 2004 (gmt 0)

10+ Year Member



I've used the Perl bindings for ImageMagick to create thumbnails with great success. You can set the width and height max for each one (120px works well by the way). It is very fast and only took about 30 minutes to index and thumbnail 10,000 images on my windows box (including the database calls and copying files from a staging area to the live server).

A former coworker of mine uses ImageMagick in his photoblog business (mod_perl) and loves it. Think of having the basics of Photoshop (or Elements I should say) accessible via a webpage to get an idea.

If you would like snippets I am sure I could dig something up in this myriad of files I call a site, just let me know.

I can't comment on any php solutions since I'm still of the school that php isn't a solution. (Sorry, not a flame, just a small opinion).