Answer the question
In order to leave comments, you need to log in
What program is there for Linux to find broken pictures/images?
Which program under Linux looks for broken images?
When optimizing images, I came across the fact that there are a lot of broken images on the site, but how to remove them in one fell swoop?
Run command
find /var/www -name "*.gif" -print0 | xargs -0 ~/usr/bin/gifsicle-1.87/src/gifsicle -b -O3
gifsicle:/var/www/photos/28060fr02.gif: read error: image corrupted, code out of range (4 times)
gifsicle:/var/www/photos/28060fr02.gif: read error: missing 8089 pixels of image data
gifsicle :/var/www/photos/97529fr02.gif: read error: image corrupted, code out of range (20 times)
gifsicle:/var/www/photos/97529fr02.gif: read error: (not reporting more errors)
Answer the question
In order to leave comments, you need to log in
No, -I produces the same result on broken and intact images:
Integer:
-bash-4.1# ~/usr/bin/gifsicle-1.87/src/gifsicle -I /var/www/paulmann/data/www/paulmann.su/photos/28060fr02.gif
* /var/www/paulmann/data/ www/paulmann.su/photos/28060fr02.gif 1 image
logical screen 120x70
global color table [256]
background 0
+ image #0 120x70
Broken:
-bash-4.1# ~/usr/bin/gifsicle-1.87/src/gifsicle -I /var/www/paulmann/data/www/paulmann.su/photos/28060bad.gif
* /var/www/paulmann/data/ www/paulmann.su/photos/28060bad.gif 1 image
logical screen 120x70
global color table [256]
background 0
+ image #0 120x70
and only by running the optimization we have:
gifsicle:/var/www/paulmann/data/www/paulmann.su/photos/28060bad.gif: read error: image corrupted, code out of range (4 times)
gifsicle:/var/www/paulmann/data/www/ paulmann.su/photos/28060bad.gif: read error: missing 8089 pixels of image data
It is almost certain that gifsicle will return a non-zero exit code when it encounters a bad image. Using this information, you can easily create a script that will remove broken images.
Something like this, but you need to test before executing on real data.
for i in `find /var/www -name "*.gif"`; do
~/usr/bin/gifsicle-1.87/src/gifsicle -I $i > /dev/null || rm $i
done
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question