Skip to content

Instantly share code, notes, and snippets.

@uhthomas
Last active April 15, 2025 22:02
Show Gist options
  • Save uhthomas/6ff306ba34751db658a46adaf719aa5d to your computer and use it in GitHub Desktop.
Save uhthomas/6ff306ba34751db658a46adaf719aa5d to your computer and use it in GitHub Desktop.
find lossless jxl images and reencode them as lossy
#!/usr/bin/env bash
set -euo pipefail
while IFS= read -r -d '' file; do
if jxlinfo "$file" | grep -iq lossless; then
echo "Image $file is lossless"
cjxl --container=1 "$file" "$file"
echo "Finished conversion"
fi
done < <(find . -type f -iname "*.jxl" -size +20M -print0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment