word/edit: decrease webp image quality to 40%
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 3 Jan 2022 04:55:10 +0000 (05:55 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 7 Feb 2022 17:42:33 +0000 (18:42 +0100)
Reduce average size from 24kB to 18kB with the same increased resolution,
more comparable to 11kB JPEGs.

Shiar_Sheet/ImagePrep.pm

index b5038cf248bcfe6dc0a62d7c730dec27f0328d32..08a97285c956aef4f547f3a3883bfcf55ef1650f 100644 (file)
@@ -41,7 +41,7 @@ sub generate {
        $cmds //= [];
        $imgpath->convert($thumbpath, $cmds, '300x200') and # low-res cover
        $imgpath->convert($thumbpath =~ s/\.jpg$/.webp/r,
-               $cmds, '600x400' # higher dpi
+               [@{$cmds}, -quality => 40], '600x400' # higher dpi tradeoff
        );
 }
 
@@ -72,10 +72,10 @@ sub convert {
                'convert',
                $$imgpath,
                -delete => '1--1', -background => 'white',
+               '-strip', -quality => '60%', -interlace => 'plane',
                -gravity => defined $cmds ? 'northwest' : 'center',
                @cmds,
                -resize => "$xyres^", -extent => $xyres,
-               '-strip', -quality => '60%', -interlace => 'plane',
                $thumbpath
        );