X-Git-Url: https://git.sesse.net/?p=pr0n;a=blobdiff_plain;f=perl%2FSesse%2Fpr0n%2FCommon.pm;h=e446ca831969567ae788fc4289912df6fd4289d7;hp=d7a081d1f8241bc6e7e6805b63a13906461d7c3b;hb=fc3721cdab3ffec3f77d445d4e7258f43ba75de1;hpb=6a46b55c9390d00d5aef5c7720622a35d48b187e diff --git a/perl/Sesse/pr0n/Common.pm b/perl/Sesse/pr0n/Common.pm index d7a081d..e446ca8 100644 --- a/perl/Sesse/pr0n/Common.pm +++ b/perl/Sesse/pr0n/Common.pm @@ -375,10 +375,12 @@ sub ensure_cached { # Use lanczos (sharper) for heavy scaling, mitchell (faster) otherwise my $filter = 'Mitchell'; my $quality = 90; + my $sf = undef; if ($width / $nwidth > 8.0 || $height / $nheight > 8.0) { $filter = 'Lanczos'; - $quality = 80; + $quality = 85; + $sf = "1x1"; } if ($xres != -1) { @@ -392,11 +394,19 @@ sub ensure_cached { # Strip EXIF tags etc. $cimg->Strip(); - if (($nwidth >= 640 && $nheight >= 480) || - ($nwidth >= 480 && $nheight >= 640)) { - $err = $cimg->write(filename=>$cachename, quality=>$quality, interlace=>'Plane'); - } else { - $err = $cimg->write(filename=>$cachename, quality=>$quality); + { + my %parms = ( + filename => $cachename, + quality => $quality + ); + if (($nwidth >= 640 && $nheight >= 480) || + ($nwidth >= 480 && $nheight >= 640)) { + $parms{'interlace'} = 'Plane'; + } + if (defined($sf)) { + $parms{'scaling-factor'} = $sf; + } + $err = $cimg->write(%parms); } undef $cimg;