From fc3501382c2aa3ef5b692f4f55c2616f9cade3f5 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 25 Apr 2025 12:18:00 +0200 Subject: Move toolbox scripts to a "bin" directory. Add a super "rtt" command to run the scripts. --- bin/rtt-update-covers | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 bin/rtt-update-covers (limited to 'bin/rtt-update-covers') diff --git a/bin/rtt-update-covers b/bin/rtt-update-covers new file mode 100755 index 0000000..0eae8e7 --- /dev/null +++ b/bin/rtt-update-covers @@ -0,0 +1,53 @@ +#!/bin/bash + +if command -v convert && command -v pngtopnm && command -v cjpeg +then + echo "Generating cover images and thumbnails!" +else + echo error: cannot find imagemagick, netpbm, and/or cjpeg + exit 1 +fi + +for F in public/*/cover.jpg public/*/cover.png +do + echo processing $F + B=$(echo $F | sed s/.jpg// | sed s/.png//) + D=$(dirname $F) + + if [ $F -nt $D/thumbnail.png ] + then + + PORTRAIT=$(convert $F -format '%[fx:w $D/thumbnail.jpg + pngtopnm $B.1x.png | cjpeg -progressive -optimize -sample 1x1 -quality 95 > $B.1x.jpg + pngtopnm $B.2x.png | cjpeg -progressive -optimize -sample 1x1 -quality 95 > $B.2x.jpg + +done -- cgit v1.2.3