ddnet/scripts/check_dilate.sh

29 lines
716 B
Bash
Raw Permalink Normal View History

2020-09-10 22:00:33 +00:00
#!/bin/bash
#set -x
result=
dil_path=$1
2020-12-02 08:57:25 +00:00
result=$(find "$2" -iname '*.png' -print0 | while IFS= read -r -d $'\0' file; do
2020-09-10 22:00:33 +00:00
new_file=$(mktemp --tmpdir "$(basename "$file" .png).XXX.png")
cp "$file" "$new_file"
2020-12-02 08:57:25 +00:00
convert "$new_file" "${new_file}_old.bmp" > /dev/null
"${dil_path}"/dilate "$new_file" > /dev/null
convert "$new_file" "${new_file}_new.bmp" > /dev/null
2020-09-10 22:00:33 +00:00
orig_hash=$(identify -quiet -format "%#" "${new_file}_old.bmp")
new_hash=$(identify -quiet -format "%#" "${new_file}_new.bmp")
rm "$new_file"
rm "${new_file}_old.bmp"
rm "${new_file}_new.bmp"
if [ "$orig_hash" != "$new_hash" ]; then
2020-12-02 08:57:25 +00:00
echo "$file is not dilated"
2020-09-10 22:00:33 +00:00
fi
done)
if [[ "$result" != "" ]]; then
2020-12-02 08:57:25 +00:00
echo -n "$result"
2020-09-10 22:00:33 +00:00
exit 1
fi
exit 0