Skip to content

Commit d73e124

Browse files
committed
add image comparison logic
1 parent e63a871 commit d73e124

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

.github/workflows/check-image-decoding.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,28 @@ jobs:
3131
mkdir decoded
3232
CMD="../Example/CLI.xcarchive/Products/usr/local/bin/SDWebImageAVIFCoder_Example CLI"
3333
for file in $(find . -name \*.avif); do
34-
"${CMD}" ${file} "./decoded/${file}.png"
34+
file=$(basename ${file})
35+
"${CMD}" "${file}" "./decoded/${file}.png"
36+
done
37+
- name: Install imagemagick to compare images.
38+
shell: bash
39+
run: brew install imagemagick
40+
- name: Compare images
41+
shell: bash
42+
run: |
43+
set -ex
44+
cd avif-sample-images
45+
for file in $(find . -name \*.avif); do
46+
file=$(basename ${file})
47+
if (cat ${file} | grep "\(monochrome\|crop\|rotate\|mirror\)"); then
48+
# FIXME(ledyba-z): Check them.
49+
echo "Ignore: ${file}"
50+
continue
51+
else
52+
score=$(compare -metric PSNR "${file}" "decoded/${file}.png")
53+
echo " * ${file}: ${score}"
54+
if test $(echo "${score} >= 30.0" | bc -l) -eq 0; then
55+
exit -1
56+
fi
57+
fi
3558
done

0 commit comments

Comments
 (0)