dieren: mkimgthumb script to resize images
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 12 Nov 2019 20:52:19 +0000 (21:52 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 6 May 2020 01:18:07 +0000 (03:18 +0200)
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

tools/mkimgthumb [new file with mode: 0755]

diff --git a/tools/mkimgthumb b/tools/mkimgthumb
new file mode 100755 (executable)
index 0000000..d7cfa15
--- /dev/null
@@ -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";
+}
+