CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Manicure for Pics

 



Coderifous
journeyman

Nov 4, 2001, 11:17 PM

Post #1 of 7 (2407 views)
Manicure for Pics Can't Post

What I have: a bunch of .jpg wedding photos.
What I want: a bunch of wedding photo thumbnails.

Anybody know of a Mod or script that would let me look at the marker "blocks" in a JPEG file and get the WxH ? I'm having fun messing around w/ the JPEGs in Binmode and screwing the PICS up royally, but I wondered if there was anything (not GD) for Perl that helped with Thumbnail creation.

Thanks,
--Jim



yapp
User

Nov 5, 2001, 12:24 AM

Post #2 of 7 (2404 views)
Re: Manicure for Pics [In reply to] Can't Post

I've heard about the module Image::Size
It's properly located at CPAN.

That's all I know.

Yet an Other Perl Programmer

_________________________________
Find out more about programming
http://www.cool-programming.f2s.com


S_Shrum
User

Nov 7, 2001, 11:15 PM

Post #3 of 7 (2395 views)
Re: Manicure for Pics [In reply to] Can't Post

I was looking into this a month or two back but have stuck to doing it the old-fashioned way...make them myself with a program called FUN THUMBS by http://photo_album.pl script.

Hope this helps.

Sean Shrum
sean@shrum.net
<A target="_blank" HREF=http://www.shrum.net/programming - Free Perl Scripts
http://www.shrum.net/soaring - Sailplane Soaring and Combat


WilliamC
stranger

Nov 16, 2001, 11:50 PM

Post #4 of 7 (2383 views)
Re: Manicure for Pics [In reply to] Can't Post

There are actualy a great number of ways to do what you want. Heres 2.

### Method 1 using pnmscale,cjpeg,djpeg (common on most linux systems)

my $cjpeg="/usr/bin/cjpeg";
my $djpeg="/usr/bin/djpeg";
my $pnmscale="/usr/bin/pnmscale";

my $width=100; # thumbnail width
my $height=100; # " height

my $scale="1/4"; # scale for djpeg... speeds it up a tad.
# if thumbnails from smaller images look strange,
# you might try setting this down to 1/2.

$infile="/home/pics/pic1.jpg";
$outfile="/home/pics/thumbs/pic1.jpg";

#obviously make sure the thumbs directory exists....

my $pixels=$width * $height;
my $command="$djpeg -fast -scale $scale $infile | $pnmscale -pixels $pixels | $cjpeg -dct fast > $outfile";
system($command);


################################################

### Method 2 using Image::Magick

$infile="/home/pics/pic1.jpg";
$outfile="/home/pics/thumbs/pic1.jpg";

#obviously make sure the thumbs directory exists....

$convert = "convert";
$thumbnail_size = "75"; # largest width or height of thumbnail

$convert="$convert -geometry ${thumbnail_size}x${thumbnail_size}+0+0";
system("$convert $infile $outfile");


PerlCoders CGI Supersite
http://www.perlcoders.com


WilliamC
stranger

Nov 16, 2001, 11:52 PM

Post #5 of 7 (2382 views)
Re: Manicure for Pics [In reply to] Can't Post

Bah, I mistated what I meant in regards to the Method 2.
It actually uses "convert" which is a program that comes with Image::Magick


PerlCoders CGI Supersite
http://www.perlcoders.com


Coderifous
journeyman

Nov 19, 2001, 11:23 AM

Post #6 of 7 (2368 views)
Re: Manicure for Pics [In reply to] Can't Post

Thanks alot... I'll be trying the magick method out as soon as I have some time. Wonderful advice sir. Much thanks Smile

--Jim



mmcw2201
User

Oct 1, 2002, 6:35 AM

Post #7 of 7 (2286 views)
Re: [WilliamC] Manicure for Pics [In reply to] Can't Post


Quote
my $cjpeg="/usr/bin/cjpeg";
my $djpeg="/usr/bin/djpeg";
my $pnmscale="/usr/bin/pnmscale";



These programs are not installed on my server. Do you know where to download those?



Quote
$convert = "convert";

I did not install Image::Magick on my server and my provider will not allow it to me. Is it possible to use the command line utility convert on it own? If so where can I download it? I am using a unix machine with freebsd!


(This post was edited by mmcw2201 on Oct 1, 2002, 6:36 AM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives