Generate png thumbnail

A

alexjaquet

Hi,

I'm looking for a way to generate png thumbnail from jpg, doe's anyone
know how do it ?.

Thanks for it.

Alexandre Jaquet
 
Z

zentara

Hi,

I'm looking for a way to generate png thumbnail from jpg, doe's anyone
know how do it ?.

Thanks for it.

Alexandre Jaquet

Run this in the directory and it will do all jpg's.

#!/usr/bin/perl
use warnings;
use strict;
use Image::Magick;

my $image = Image::Magick->new;
umask 0022;
my @pics= <*.jpg>;

foreach my $pic (@pics){
my ($picbasename) = $pic =~ /^(.*).jpg$/;
my $ok;
$ok = $image->Read($pic) and warn ($ok);
my $thumb = $picbasename . '-t.png';
$image->Scale(geometry => '100x100');
$ok = $image->Write($thumb) and warn ($ok);
undef @$image; #needed if $image is created outside loop
print "$pic -> $thumb\n";
}
__END__
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top