termimg script to identify images
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 9 Feb 2020 15:54:19 +0000 (16:54 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Sun, 9 Feb 2020 15:57:04 +0000 (16:57 +0100)
Simple fingerprint creating an ascii thumbnail for use in diffs.

termimg [new file with mode: 0755]

diff --git a/termimg b/termimg
new file mode 100755 (executable)
index 0000000..2545c9b
--- /dev/null
+++ b/termimg
@@ -0,0 +1,10 @@
+#!/bin/sh
+convert -compress none -resize 66x23 - pgm:- |
+perl -nE '
+$_ eq "P2\n" or die "ascii pgm input required\n" if $. == 1;
+next if $. <= 3;
+
+state @ch = split //, " .oO@";
+print $ch[ $_ / 256 * @ch ] for /\d+/g;
+print $/;
+'