Skip to content

reformat0r/find_corrupt_jpegs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

find_corrupt_jpegs.sh

Finds JPEG files that lack an End-Of-Image marker and are thus corrupt (for example due to a partial/failed download).
Such files often pass validation checks of other tools because they start with a valid file header.

Installation

wget "https://raw.githubusercontent.com/reformat0r/find_corrupt_jpegs/master/find_corrupt_jpegs.sh" && chmod +x find_corrupt_jpegs.sh

Usage

./find_corrupt_jpegs.sh outfile.txt my_photo_dir another_dir photos_*_2020

Example output

 ▇▇▇▇▇▇▇▇▇▇▇      |  70% - 1 broken

Output file

$ cat outfile.txt
my_photo_dir/foo.jpg
another_dir/bar.jpg
photos_03_2020/all_is_vibration.jpg






Example JPEG, truncated

file utility:

$ file example_truncated.jpg 
example_truncated.jpg: JPEG image data, JFIF standard 1.01, resolution (DPI), density 96x96, segment length 16, baseline, precision 8, 593x334, components 3

Python with Pillow

from PIL import Image

with Image.open("example_truncated.jpg") as im:
    im.verify()    # im.transpose(Image.FLIP_LEFT_RIGHT) does raise an exception

print("File passed validation.")

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages