Skip to content

Instantly share code, notes, and snippets.

@Shnatsel
Created March 10, 2023 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shnatsel/3effeeaa09b7ae7fc1ea4dc9cf1c98d5 to your computer and use it in GitHub Desktop.
Save Shnatsel/3effeeaa09b7ae7fc1ea4dc9cf1c98d5 to your computer and use it in GitHub Desktop.
#!/bin/sh
set -e
input="$1"
output1="$(mktemp --tmpdir result_XXXXXXXXXXXXX.ppm)"
output2="$(mktemp --tmpdir result_XXXXXXXXXXXXX.ppm)"
trap "rm -f "$output1" "$output2"" EXIT
if ! yes | /home/shnatsel/Code/zune-image/target/release/zune --safe --input "$input" --out "$output1" >/dev/null 2>&1; then
echo "Failed to decode safe $input"
exit 1
fi
if ! yes | /home/shnatsel/Code/zune-image/target/release/zune --input "$input" --out "$output2" >/dev/null 2>&1; then
echo "Failed to decode unsafe $input"
exit 1
fi
similarity=$(compare -quiet -metric RMSE "$output1" "$output2" /dev/null 2>&1) || true
echo "$similarity $input"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment