X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=OSX%2Fupdate-thumbnail.pl;h=da95f4aea3f1b2398461240cbc4f09d25400cd0f;hb=88cfe534a698a0562e81345957a50714af1453bc;hp=0df5d1f72ac7eea19fb0ebdf47a6878eb6d3d34f;hpb=4ade52359b6eba3621566dac79793a33aa4c915f;p=xscreensaver diff --git a/OSX/update-thumbnail.pl b/OSX/update-thumbnail.pl index 0df5d1f7..da95f4ae 100755 --- a/OSX/update-thumbnail.pl +++ b/OSX/update-thumbnail.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# Copyright © 2006-2013 Jamie Zawinski +# Copyright © 2006-2014 Jamie Zawinski # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that @@ -18,7 +18,7 @@ require 5; use strict; my $progname = $0; $progname =~ s@.*/@@g; -my $version = q{ $Revision: 1.2 $ }; $version =~ s/^[^0-9]+([0-9.]+).*$/$1/; +my ($version) = ('$Revision: 1.4 $' =~ m/\s(\d[.\d]+)\s/s); my $verbose = 1; @@ -92,9 +92,12 @@ sub update($$) { rand(0xFFFFFFFF)); my @cmd = ("convert", $img, + "-strip", "-resize", $size . "^", "-gravity", "center", "-extent", $size, + "-quality", "95", # saves 8% + "+dither", "-colors", "128", # Saves an additional 61% $tmp); print STDERR "$progname: exec: " . join(' ', @cmd) . "\n" @@ -106,6 +109,17 @@ sub update($$) { error ("failed: " . join(" ", @cmd)); } + # This only saves 0.4% on top of the above. + # @cmd = ("optipng", "-quiet", "-o7", $tmp); + # print STDERR "$progname: exec: " . join(' ', @cmd) . "\n" + # if ($verbose > 2); + # safe_system (@cmd); + + if (! -s $tmp) { + unlink $tmp; + error ("failed: " . join(" ", @cmd)); + } + if (! cmp_files ($tmp, $target)) { unlink $tmp; print STDERR "$progname: $target: unchanged\n" if ($verbose > 1);