Skip to content

Instantly share code, notes, and snippets.

@molotovbliss
Last active March 30, 2022 13:00
Show Gist options
  • Save molotovbliss/a83d6ee4fe85660887e94ef352707341 to your computer and use it in GitHub Desktop.
Save molotovbliss/a83d6ee4fe85660887e94ef352707341 to your computer and use it in GitHub Desktop.
Find malformed/invalid images recursively with ImageMagick's identify utility of current working dir

Find malformed/invalid images recursively

with ImageMagick's identify utility of current working dir

display output listing of current file scanned, only non 0 exit status get logged.

find -D rates . -type f \( -name '*.gif' -o -name '*.png' -o -name '*.jpg' -o -name '*.jpeg' \) -print -exec bash -c 'identify "$1" &> /dev/null || echo "$1" >> invalid-imgs.log' none {} \;


forked & modified from:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment