EXIF APP1 segment too large! Error in only one of many pictures

Started by mads, June 18, 2013, 07:05:23 PM

Previous topic - Next topic

mads

Hi,

I wonder what I can do to get rid of this error which prevents me from setting a property in the file. I should say that other pictures generated with the same hardware (sgs4 phone) has been working fine so far.

Error: EXIF APP1 segment too large! (65610 bytes) - ./20130615_104146.jpg
    1 directories scanned
    0 image files updated
    1 files weren't updated due to errors
    1 directories scanned
    1 files failed condition
    0 image files read

Hope you can help me out!

I am using exif tool version 9.31 on windows 7 64 bit.

I have attached mailed you the problematic image.

The command lines in my otherwise working batch file is like this:

c:\$\iCE\exiftool.exe -if "$DocumentName eq ''" "-DocumentName<$BaseName" -Artist="MSS" -Copyright="MSS" "-fileModifyDate<${dateTimeOriginal}" -overwrite_original -ext jpg .
c:\$\iCE\exiftool.exe -if "$DocumentName ne ''" -d "%%Y-%%m-%%d %%H.%%M.%%S" "-filename<${CreateDate} [$MyFileName].%%e" -overwrite_original -ext jpg .






Thanks,
Mads

Phil Harvey

Hi Mads,

Very interesting.  I have never seen an EXIF APP1 that was so full you couldn't add something simple like a DocumentName, but that is the problem here.  The maximum size of a JPEG APP segment is 65533 bytes, and it is already 65522 bytes in your original image.  There isn't even enough room for the overhead of 12 bytes for a new EXIF IFD entry.  And what is surprising, there is no unused space that ExifTool could have reclaimed to make room for this.  The ThumbnailImage is the biggest space hog, at 60172 bytes, and the UserComment is also substantial, at 4104 bytes.  Reduce the space used by either of these, and you are good to go.

- 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 ($).

mads

Thank you for answering so quickly.

UserComment... It reminds me of another thing... When processing image files from my old phone, a SGS3, exiftool actually warns about something in the usercomment for every file.

Warning: Invalid EXIF text encoding - ./20130327_175735.jpg

But it processes the files anyway so I haven't looked more into that.

A few weeks ago I got the SGS4 anyway and it seems to write different data in the usercomment tag as exiftool has stopped warning when I processing files produced by this.

Anyway.. I am not aware of any usercomment or thumbnail in the files, so I guess it's purely handled by the samsung firmware, and I wouldn't be surprised if they hide/keeps some of all their harvested data in a field like the usercomment.

But it's basicly out of my hand as the image is untouched from the phone.. and it means that once every 100 file won't be processed by my batch file because of this random issue. It is a problem for me! What would you suggest I do, remove info from the file? Like the usercomment? Would I miss it? Can I remove anything at all when it has a corrupt or too full field.. and if yes, how do I do that?

Phil Harvey

The "Invalid EXIF text encoding" error is a bug in the way your old phone wrote EXIF text.

Only you can answer the question of whether or not the Samsung UserComment is useful to you.  You can remove (almost) anything you want with -TAG=

- 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 ($).

mads

Hi Phil,

You said that the "UserComment is also substantial, at 4104 bytes".

I am curious to see what it contains before I decide to delete it as part of my autorename script. But when I output the content in the command line I only see "METADATA-START" as content in the UserComment tag. How do I inspect all the 4104 bytes?

Would it also hypothetically be possible to shrink the thumbnail as an alternative, although I'm already liking clearing the UserComment tag better, as it seems more simple, and all I need to add is a little room for the original filename and some copyright info.

Also if I decide to delete it, the usercomment tag, is it possible to somehow detect such write error I occasionally get because of metadata being to big images and then only clear UserComment for those odd files and not all?

Thanks...

/Mads

Phil Harvey

Hi Mads,

You can use the -v3 option to see the binary data of all tags (or -v4 to see the big binary data blocks).

One way to detect which files weren't written is to check to see if the information you wrote exists in the file.  If it doesn't, then there was a problem when writing, so you can try again but delete the UserComment this time.

- Phil

Edit: I just checked your image, and you actually need -v5 to see the entire UserComment block.  It contains a lot of garbage, and lots of bogus hex values like 0xdeadbeef.  There may be some useful camera-related information in there, but right now ExifTool doesn't decode any of it.

...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 ($).