Created
March 3, 2026 02:50
-
-
Save renanyoy/98c915c526bfd97e9ae0214c2b44af74 to your computer and use it in GitHub Desktop.
verify jpeg (needs imagemagick)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function fixwrongjpeg() { | |
| find . -name "*.jpg" | while IFS= read -r file; do | |
| mime=$(file --mime-type -b "$file") | |
| if [[ $mime != image/jpeg ]]; then | |
| mv "$file" "$file.wrong" | |
| convert "$file.wrong" "$file" | |
| echo "fixed $file" | |
| rm "$file.wrong" | |
| fi | |
| done | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment