Not to beat an old topic to death but I have found that
montage handles this much better. I haven't figured out how to get the individual slides combined into one picture on the html page but at least it's only making one png file and there aren't any gifs bouncing all over the page .
$name2 =~ s/\.\w{3}$/_THUMB\.png/;
system(`montage $name1 -geometry '100x100' $name2`);
Code:
#!/usr/bin/perl
# use the command: perl images.pl > index.html
# Set up in rows of 4 pics so you need an amount
# of pics that is evenly divided by 4
use strict; # enforce variable declarations and quoting
mkdir "thumbs", 0777 unless -d "thumbs";
my $i;
my $j;
my $new_row = 0;
my @name=sort(`ls *.jpg *.gif *.png`) ;
my $name1;
my $name2;
if ( (scalar @name)%4 !=0) {
print "Wrong number of pics in directory, quitting!\n";
exit;
}
print <<HEADER_EOF;
<!-- \/ starthtml -->
<html>
<body bgcolor="#FFFFFF" text="#000000" link="#FFFFFF" vlink="#FFFFFF">
<table align=\"center\" width=\"80%\" border="1" cellpadding="5" cellspacing="2">
HEADER_EOF
for($i=0; $i < (scalar @name) ; $i=$i+4){
print "<tr align=\"center\">\n";
for( $j=0; $j<4 ; $j++){
chomp( $name[$i+$j] );
$name1 = $name[$i+$j];
$name2 = $name[$i+$j];
$name2 =~ s/\.\w{3}$/_THUMB\.png/;
# system(`convert $name1 -geometry '100x100' $name2`);
system(`montage $name1 -geometry '100x100' $name2`);
system(`mv $name2 ./thumbs/`);
print "<td align=\"center\"><a href=\"$name1\"><img src=\"./thumbs/$name2\"></a><div>$name1</div></td>\n";
}
print "</tr>\n";
}
print <<FOOTER_EOF;
</td></tr></table>
</body>
</html>
FOOTER_EOF