X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/b8356cfbfb64e8103dadc2e96c1c62ee13a3f687..1def557f31f633446b727c7f973f16e5a7838aa5:/Shiar_Sheet/ImagePrep.pm diff --git a/Shiar_Sheet/ImagePrep.pm b/Shiar_Sheet/ImagePrep.pm index 2bd4cd9..04a4270 100644 --- a/Shiar_Sheet/ImagePrep.pm +++ b/Shiar_Sheet/ImagePrep.pm @@ -31,14 +31,15 @@ sub dimensions ($imgpath) { return split /\s/, $xy, 3; } -sub generate ($imgpath, $thumbpath, $cmds) { +sub generate ($imgpath, $thumbpath, $opt) { if (not -e $$imgpath) { return !-e $thumbpath || unlink $thumbpath; } - $cmds //= []; - $imgpath->convert($thumbpath, $cmds, '300x200') and # low-res cover + my @cmds = @{$opt->{convert} // []}; + unshift @cmds, -area => $_ for $opt->{crop32} || (); + $imgpath->convert($thumbpath, \@cmds, '300x200') and # low-res cover $imgpath->convert($thumbpath =~ s/\.jpg$/.webp/r, - [@{$cmds}, -quality => 40], '600x400' # higher dpi tradeoff + [@cmds, -quality => 40], '600x400' # higher dpi tradeoff ); }