Welcome to WebmasterWorld Guest from 23.20.77.100

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)

Junior Member

10+ Year Member

joined:Apr 2, 2004
posts:41
votes: 0


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 June 16, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Apr 2, 2004
posts:41
votes: 0


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 June 16, 2004 (gmt 0)

Senior Member

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

joined:Mar 15, 2002
posts:6807
votes: 0


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

Junior Member

10+ Year Member

joined:Apr 1, 2004
posts:137
votes: 0


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

[search.cpan.org...]

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

Preferred Member

10+ Year Member

joined:Dec 30, 2003
posts:428
votes: 0


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

Sean

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

Junior Member

10+ Year Member

joined:Apr 2, 2004
posts:41
votes: 0


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 June 17, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 12, 2002
posts:43
votes: 0


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 June 18, 2004 (gmt 0)

New User

10+ Year Member

joined:June 16, 2004
posts:21
votes: 0


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 July 18, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:July 17, 2004
posts:73
votes: 0


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