]> Sergey Matveev's repositories - dotfiles.git/commitdiff
Newer cjxl does not support stdin input
authorSergey Matveev <stargrave@stargrave.org>
Sun, 30 Oct 2022 14:05:28 +0000 (17:05 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 30 Oct 2022 14:05:28 +0000 (17:05 +0300)
img/bin/transcode-jpg.sh

index f974f161ae0abf3788c91ff8cc295226baf83a68..b97ff1f10943cee8aaf873fb2fafdf0b35e5d4c6 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/sh -e
 
-jpegtran -optimize -progressive -perfect -copy all "$1" |
-    cjxl - "${1%.*}.jxl" -d 0 -e 9
+tmp=`mktemp`
+trap "rm -f $tmp.jpg" HUP PIPE INT QUIT TERM EXIT
+jpegtran -optimize -progressive -perfect -copy all "$1" > $tmp.jpg
+cjxl $tmp.jpg "${1%.*}.jxl" -d 0 -e 9 --lossless_jpeg=1
 [ -s "${1%.*}.jxl" ]