use an image program to open the image that will error
out
and close if the file is corrupt. Check the return value
of the program, if it exits with an error, then echo
"blah blah blah" or something.
I thought about something like that, but I haven't figured out how to work around and
trap the eventual error dialog.
We could use kuickshow or kview to test png, gif, and jpg/jpeg images; gwenview to test
svg/svgz images; and the safest bet for xcf is gimp.
I haven't run any tests to see what kind of exit code those apps produce for success
and failure.
A script run during the night would be nice:
test_tde_image () {
for i in `find $GIT_SOURCES -name *.$FILE_TYPE`; do
$IMAGE_APP $i
# How to trap and close error dialogs? &>/dev/null?
# Allow time for images to load?
sleep 5
# How to close the app?
EXIT_CODE="$?"
if [ "$EXIT_CODE" != "0" ]; then
echo "$i failed to open without error." >> $LOG_FILE
fi
done
}
GIT_SOURCES=/path/to/GIT/sources
LOG_FILE=/path/to/corrupt-tde-image.log
touch $LOG_FILE
FILE_TYPE="png"
IMAGE_APP=kuickshow
test_tde_image
FILE_TYPE="gif"
IMAGE_APP=kuickshow
test_tde_image
FILE_TYPE="jpg"
IMAGE_APP=kuickshow
test_tde_image
FILE_TYPE="jpeg"
IMAGE_APP=kuickshow
test_tde_image
FILE_TYPE="svg"
IMAGE_APP=gwenview
test_tde_image
FILE_TYPE="svgz"
IMAGE_APP=gwenview
test_tde_image
FILE_TYPE="xcf"
IMAGE_APP=gimp
test_tde_image
Or something like that.
Darrell