#!/bin/sh -e tmp=`mktemp` trap "rm -f $tmp $tmp.jpg" HUP PIPE INT QUIT TERM EXIT src="$1" shift jpegtran -optimize -progressive -perfect -copy all "$src" >$tmp.jpg cjxl $tmp.jpg "${src%.*}.jxl" $@ \ --distance=0 --effort=10 --brotli_effort=11 --lossless_jpeg=1 [ -s "${src%.*}.jxl" ] touch -r "$src" "${src%.*}.jxl"