From: Mischa POSLAWSKY Date: Tue, 12 Nov 2019 20:52:19 +0000 (+0100) Subject: dieren: mkimgthumb script to resize images X-Git-Tag: v1.12~9 X-Git-Url: http://git.shiar.net/sheet.git/commitdiff_plain/cefb32fb2ec1447f7d590b90556ce5f669b6ac9f dieren: mkimgthumb script to resize images Replaces a previously untracked set of convert rules such as: waterleeuw => '-shave:5%x12%:-chop:20%x0:-flop:-gamma:.8', to postprocess various images, storing this metadata in their file names instead renaming the original waterleeuw.jpg to: waterleeuw:-shave:5%x12%:-chop:20%x0:-flop:-gamma:.8.jpg --- diff --git a/tools/mkimgthumb b/tools/mkimgthumb new file mode 100755 index 0000000..d7cfa15 --- /dev/null +++ b/tools/mkimgthumb @@ -0,0 +1,13 @@ +#!/usr/bin/env perl +use 5.014; +use warnings; + +for my $src (@ARGV) { + my ($name, @cmds) = split /:/, $src =~ s/\.jpg$//r; + say $name; + unshift @cmds, -gravity => 'northwest'; + push @cmds, -resize => '300x200^', -gravity => 'north', -extent => '300x200'; + push @cmds, '-strip', -quality => '60%'; + system convert => @cmds, $src => "../$name.jpg"; +} +