Which warnings indicate serious JPG corruption?

Started by JoeS, March 02, 2020, 03:24:37 PM

Previous topic - Next topic

JoeS

By chance I found a few JPGs in my photoalbum that were corrupted.

When I tried to open them, half the image was missing (example attached)

I ran Exiftool on them looking for warnings, and the warning that was returned was "JPEG format error"#

I wanted to see if there were any other photos in my vast album that were corrupted in this way (so they could not be properly viewed and had missing information).

I have tried running Exiftool on larger sections of my photoalbum, with many many warning returned saying a huge number of different things. Even discounting the minor warnings, I found that all of the non-minor warnings still didn't prevent me from fully opening the photos.

For example one JPG taking in 2001 had 25 warnings:
Non-standard format (rational64u) for IFD1 0x9286 UserComment
Duplicate tag 0x9286 UserComment in IFD1
Invalid EXIF text encoding for UserComment
Wrong IFD for 0x9286 UserComment (should be ExifIFD not IFD1)
Non-standard format (int16u) for IFD1 0x9286 UserComment
Duplicate tag 0x9286 UserComment in IFD1
Wrong IFD for 0x9286 UserComment (should be ExifIFD not IFD1)
Non-standard format (int32u) for IFD1 0x9286 UserComment
Duplicate tag 0x9286 UserComment in IFD1
Wrong IFD for 0x9286 UserComment (should be ExifIFD not IFD1)
Tag ID 0xa002 ExifImageWidth out of sequence in ExifIFD
Non-standard format (int32u) for IFD1 0x9286 UserComment
Duplicate tag 0x9286 UserComment in IFD1
Tag ID 0x0213 YCbCrPositioning out of sequence in IFD1
Missing required JPEG IFD1 tag 0x0103 Compression
Missing required JPEG IFD1 tag 0x011a XResolution
Missing required JPEG IFD1 tag 0x011b YResolution
Missing required JPEG IFD1 tag 0x0128 ResolutionUnit
Missing required JPEG IFD1 tag 0x0201 ThumbnailOffset
Missing required JPEG IFD1 tag 0x0202 ThumbnailLength
Wrong IFD for 0x9286 UserComment (should be ExifIFD not IFD1)
Non-standard format (int16u) for IFD1 0x9286 UserComment
Entries in IFD1 are out of order
Tag ID 0x0112 Orientation out of sequence in IFD1
Wrong IFD for 0x9286 UserComment (should be ExifIFD not IFD1)
Non-standard format (rational64u) for IFD1 0x9286 UserComment
Invalid EXIF text encoding for UserComment
Wrong IFD for 0x9286 UserComment (should be ExifIFD not IFD1)


Despite all these warnings I could still open and view the file, and if I hadn't have run exiftool I wouldn't have know anything was wrong with it.

The only thing I really care about is being able to open and view my old photos from the last 20 years - mostly made up from JPG images from countless digital cameras and mobile phones. I don't care if a JPG brings up warnings if those warnings still allow me to view the file.

I know now that I need to look for "JPEG format error", but are there any other warnings I should look out for that indicate a corrupted JPG file with missing image data?

I feel like all the many warnings I have recieved so far can safely be ignored - can they?

Many thanks.

StarGeek

Exiftool does have a -Validate option, but I believe that mostly looks at the metadata part of the file.  It shows three warnings for your attached image but nothing to indicate that the jpeg itself was corrupt. 

One of the original command line jpeg programs, jpegtran.exe, does indicate that there is a problem.  Here's the output
C:\>jpegtran.exe -outfile nul:  "Y:\!temp\qz\DSC_8584 - Copy.jpg"
Corrupt JPEG data: premature end of data segment


It also has a RC of non-zero when it detects a problem.  It's not perfect and doesn't always find minor errors, though.

I still haven't found a program which allows to batch check jpgs for format problems.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

That's a really odd corruption.  Normally if the bottom of the image is missing, so is the JPEG end-of-image marker.  But the EOI marker is intact in this file, so somehow some image data in the middle must be messed up, causing the JPEG decoder to abort prematurely.  Interesting.  ExifTool would not detect an error like this because it does not attempt to decode the JPEG image.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

JoeS

Thank you both, perhaps this corruption is just a strange anomoly in this folder. I understand now that Exiftool will not be able to detect corruption like this.

I've just had a look at jpegtran, thanks for the reccomendation.