Menu

Exiftool failing on photos in Exif version 0230

D B
2022-09-28
2022-09-30
  • D B

    D B - 2022-09-28

    I have a script that has been running fine for years. This year I keep getting failures and I think I tracked down to photos in exif version 0230. All the 0220 work fine.

    If I try to edit the exif comments in windows I get an error Too much metadata. See attached.
    Some of these even come off the same tablet so I am not sure why some are 0220 and some 0230.

    Seems to affect Samsung as iOS does not seem to fill our the exif version field at all.

    Any help appreciated I am stuck. Not finding any posts on this. Using the latest version.

    code
    result = et.execute(bytes(newComment), bytes(jpgFile), bytes("-overwrite_original_in_place"), bytes("-preserve"))

    error
    0 image files updated
    1 files weren't updated due to errors

    thanks

     
  • StarGeek

    StarGeek - 2022-09-28

    Can you share a sample image that has this problem?

    Also, do a validation check on the image to see what problems there might be

    exiftool -G1 -a -s -warning -validate file.jpg

     
  • D B

    D B - 2022-09-28

    Sorry I thought I did attach it.

    I ran this but all I get back is empty string.

    import exiftool

    jpgFile = r"C:\temp\TD\Photos\NM\NM_SFO_LUP_2020_FGR_039_V12022-09-01\NM_SFO_LUP_2020_FGR_039_V1_Misc2_20220607.jpg"

    with exiftool.ExifTool() as et:
    #et -G1 -a -s -warning -validate jpgFile
    result = et.execute(bytes(jpgFile), bytes("-G1 -a -s -warning -validate"))
    print result

     
  • StarGeek

    StarGeek - 2022-09-28

    There's no metadata in that file. It's been stripped away. I don't know if that's something SourceForge does or not.

    Can you share a file through Google drive or Dropbox? Not OneDrive, as that will edit the file.

     
  • StarGeek

    StarGeek - 2022-09-28

    There are a lot of problems with that file

    C:\>exiftool -g1 -a -s -warning -validate "Y:/!temp/ccc/g/NM_SFO_LUP_2020_FGR_039_V1_Misc2_20220607 (1).jpg"|clip
    ---- ExifTool ----
    Warning                         : [minor] Odd offset for IFD0 tag 0x0132 ModifyDate
    Warning                         : [minor] Odd offset for IFD0 tag 0x9c9b XPTitle
    Warning                         : Entries in IFD0 are out of order
    Warning                         : Tag ID 0x8769 ExifOffset out of sequence in IFD0
    Warning                         : [minor] Odd offset for ExifIFD tag 0x829a ExposureTime
    Warning                         : Value for ExifIFD tag 0x829a ExposureTime overlaps IFD
    Warning                         : [minor] Odd offset for ExifIFD tag 0x829d FNumber
    Warning                         : [minor] Odd offset for ExifIFD tag 0x9003 DateTimeOriginal
    Warning                         : [minor] Odd offset for ExifIFD tag 0x9004 CreateDate
    Warning                         : [minor] Odd offset for ExifIFD tag 0x9201 ShutterSpeedValue
    Warning                         : [minor] Odd offset for ExifIFD tag 0x9202 ApertureValue
    Warning                         : [minor] Odd offset for ExifIFD tag 0x9203 BrightnessValue
    Warning                         : [minor] Odd offset for ExifIFD tag 0x9204 ExposureCompensation
    Warning                         : [minor] Odd offset for ExifIFD tag 0x9205 MaxApertureValue
    Warning                         : [minor] Odd offset for ExifIFD tag 0x920a FocalLength
    Warning                         : [minor] Odd offset for ExifIFD tag 0x927c
    Warning                         : [minor] Odd offset for ExifIFD tag 0x9286 UserComment
    Warning                         : [minor] Odd offset for ExifIFD tag 0x9291 SubSecTimeOriginal
    Warning                         : [minor] Unknown value for ExifIFD:SceneType
    Warning                         : [minor] Odd offset for ExifIFD tag 0xa404 DigitalZoomRatio
    Warning                         : [minor] Undefined value for ExifIFD:DigitalZoomRatio
    Warning                         : [minor] Odd offset for ExifIFD tag 0xa420 ImageUniqueID
    Warning                         : Value for GPS tag 0x0002 GPSLatitude overlaps IFD
    Warning                         : [minor] Odd offset for GPS tag 0x001d GPSDateStamp
    Warning                         : Value for IFD1 tag 0x011a XResolution overlaps IFD
    Warning                         : Entries in IFD1 are out of order
    Warning                         : Tag ID 0x0112 Orientation out of sequence in IFD1
    Warning                         : Bad format (0) for IFD2 entry 0
    Warning                         : [minor] IFD0 tag 0x0100 ImageWidth is not allowed in JPEG
    Warning                         : [minor] IFD0 tag 0x0101 ImageHeight is not allowed in JPEG
    Validate                        : 30 Warnings (22 minor)
    

    You might try the command in FAQ #20 to repair the files. Make sure you have backups and check the results.

    When I ran that command on the file, the differences were minimal.

     
  • D B

    D B - 2022-09-29

    Weird when I run that exact line you did I just get 2 minor warnings. See attached.

    I then ran
    exiftool -all= -tagsfromfile @ -all:all -unsafe -icc_profile NM_SFO_LUP_2020_FGR_039_V1_Misc2_20220607.jpg

    But the file still gives that same too much metadata error.

    I think it is a Samsung issue. I am finding some posts of this happening on certain updates. Mostly seeing Active 2 and Active Pro issues. Going to test some more but the photos from all summer are not looking good.

    Will report if I find out anything.

    Thanks a lot for the help!

     
  • StarGeek

    StarGeek - 2022-09-29

    I'm guessing the two warnings are Undefined value for ExifIFD:DigitalZoomRatio and Unknown value for ExifIFD:SceneType. Which is what I get after running the fix.

    I tried editing under the Windows properties and got the same error. Tried removing the two tags listed above and that didn't help.

    I finally fixed the problem by removing the thumbnail image
    exiftool -ThumbnailImage= NM_SFO_LUP_2020_FGR_039_V1_Misc2_20220607.jpg

    This error has popped up once before where the user was just loading and resaving the file. I had suggested using Irfanview to run a lossless re-write of the file to fix it. But just removing the thumbnail is a better option, IMO.

     
  • D B

    D B - 2022-09-29

    Well dang I did see that post but not the very last message. Not sure how I missed that.

    It seems to work on my test image! Let me try all 800 and see if I can script it.

    Thanks I almost gave up!

     
  • StarGeek

    StarGeek - 2022-09-29

    The very last post was added this morning. I hate necro-posting, but it was appropriate for that thread.

     
  • D B

    D B - 2022-09-29

    Turns out I had to do both of your posted lines. Just the thumbnail did not do it. I combined them like this which works on a command line.
    exiftool -exif:all= -tagsfromfile @ -exif:all -unsafe -F -ThumbnailImage= C:\temp\NM_SFO_LUP_2020_FGR_039_V1_Misc2_20220607.jpg

    But I cannot get this to work in Python. No error just does not fix it.
    I am not really sure how to format it - before I had to use bytes for each argument to get it to go but I cannot find a format that works for this.
    Any ideas here.
    tried
    resultFix = et.execute(bytes("-exif:all= -tagsfromfile @ -exif:all -unsafe -F -ThumbnailImage= " + jpgFile))
    and
    resultFix = et.execute(bytes("-exif:all= -tagsfromfile @ -exif:all"), bytes("-unsafe"), bytes("-F"), bytes("-ThumbnailImage= " + jpgFile))
    I also tried quoting the path.

    Plus some other variants with no luck still fails here
    result = et.execute(bytes(newComment), bytes(jpgFile), bytes("-overwrite_original_in_place"), bytes("-preserve"))
    0 image files updated
    1 files weren't updated due to errors

    thanks really close now!
    
     
  • D B

    D B - 2022-09-29

    Well I think I got it now. No need for bytes not sure where I got that.

    This works except it is not honoring the preserve and it is changing the date on me. Preserve works in the next line so not sure what is up there.

    resultFix = et.execute("-exif:all= ", "-tagsfromfile @ ", "-exif:all", "-unsafe", "-F", "-overwrite_original_in_place", "-ThumbnailImage= ", jpgFile, "-preserve")

    Also tried -P instead but still changing the date on me
    resultFix = et.execute("-exif:all= ", "-tagsfromfile @ ", "-exif:all", "-unsafe", "-F", "-P", "-overwrite_original_in_place", "-ThumbnailImage= ", jpgFile)

    this does preserve
    result = et.execute(bytes(newComment), bytes(jpgFile), bytes("-overwrite_original_in_place"), bytes("-preserve"))

    Only bummer is it is now stripping all my Exif on the images with an issue. But I guess that makes sense. Just not sure why -P does not work.

    Very close now. thanks

     

    Last edit: D B 2022-09-29
  • StarGeek

    StarGeek - 2022-09-29

    Only bummer is it is now stripping all my Exif on the images with an issue

    Remove -exif:all= That's what is stripping the EXIF data. All you need to do to fix it is remove the thumbnail.

     
  • D B

    D B - 2022-09-29

    Sorry what i was trying to say above it just striping the thumbnail is not enough and it fails
    C:\temp>exiftool -ThumbnailImage= C:\temp\NM_SFO_LUP_2020_FGR_039_V1_Misc2_20220607.jpg
    Warning: [minor] Entries in IFD0 were out of sequence. Fixed. - C:/temp/NM_SFO_LUP_2020_FGR_039_V1_Misc2_20220607.jpg
    Error: Bad format (0) for IFD2 entry 0 - C:/temp/NM_SFO_LUP_2020_FGR_039_V1_Misc2_20220607.jpg
    0 image files updated
    1 files weren't updated due to errors

    I think you are testing on an edited file.  There must be something else in the tag that it does not like but not sure what.  I tried all sorts of combinations but nothing yet.  May have to strip it all of I can't find it.
    
    Will post final outcome.  What a mess.
    thanks!
    
     
  • D B

    D B - 2022-09-29

    I was using the second sample from FAQ 20 above instead of the first one.

    I finally got a combination that works in the command line - it fixes the file and retains the Exif.

    exiftool -all= -tagsfromfile @ -all:all -unsafe -preserve -F -icc_profile -overwrite_original_in_place -ThumbnailImage= C:\temp\TD\Photos\Test\NM_SFO_LUP_2020_FGR_039_V1_Misc2_20220607.jpg

    But I cannot get it to work in Python I got the syntax wrong somewhere but I cant figure it out.
    resultFix = et.execute("-all=", "-tagsfromfile", "@", "-all:all", "-unsafe", "icc-profile", "-P", "-F", "-overwrite_original_in_place", "-ThumbnailImage=", jpgFile)
    Tried 100 combinations but cant get it.

    I get this error says it update then could not update. Not sure how it can be both.
    1 image files updated
    1 files weren't updated due to errors

    thanks
    
     
  • StarGeek

    StarGeek - 2022-09-29

    You're missing the dash in front of icc-profile. Exiftool takes that to mean there's a file called "icc-profile" to process, which results in the 1 files weren't updated due to errors

    I would suggest using -overwrite_original instead of -overwrite_original_in_place. The second option is much slower. It has uses on a Mac, where there are MDItem and XAtt file system tag which would be lost without it. But on Windows it has not real use unless the file has an ADS, which is rare.

     
  • D B

    D B - 2022-09-29

    Was just going to post I found the -icc one.

    That part now works but now when I try to add a comment it does not work. If I manually edit the comment then run it again it does work. Which is nuts.

    Then I changed to all one line. I also changed to the [] format I found trying to fix it.

    resultFix = et.execute(*["-all="] + ["-tagsfromfile"] + ["@"] + ["-all:all"] + ["-XPComment=test"] + ["-preserve"] + ["-overwrite_original"] + ["-ThumbnailImage= "] + [jpgFile])

    I get this resultFix 1 image files updated

    It does fix the photo but now it refuses to add the comment.
    Same with command line I now cant edit XPComment anymore. This does nothing now
    exiftool -XPComment=test C:\temp\TD\Photos\Test\NM_SFO_LUP_2020_FGR_039_V1_Misc2_20220607.jpg

    Every time I think I got it.

    I will keep at it thanks for all the help.

     
  • D B

    D B - 2022-09-30

    See gif. For some reason this process is making the comment uneditable until I manually change it then comes back. So weird. Not sure what the heck is going on now. I get one thing and lose another.
    I can edit Title and Subject just fine. Must be something with the bad tags coming over. I guess its lose the tags or get comments but not both.

    thanks

     

    Last edit: D B 2022-09-30
  • D B

    D B - 2022-09-30

    To finish up I never did get it to work. I can edit the Title and subject even but somehow it is now locking XPComment. I think there is still a bad tag info there somewhere.

    So instead I copied just the GPS info and erased the rest. Not perfect but it gets what we need.

    Final code
    exiftool -all= -tagsfromfile @ -GPSLatitude -tagsfromfile @ -GPSLongitude -tagsfromfile @ -GPSAltitude -XPComment=test -ThumbnailImage= C:\temp\TD\Photos\Test\NM_SFO_LUP_2020_FGR_039_V1_Misc2_20220607.jpg
    This copies just those 3 fields and wipes the rest. After that I can add a XPComment just fine.

    In Python added code to only do this if there was an issue.
    result = et.execute([newComment] + ["-overwrite_original"] + ["-P"] + [jpgFile])
    if "files weren't updated due to errors" in result:
    failCount += 1
    result = et.execute(
    ["-all="] + ["-tagsfromfile"] + ["@"] + ["-GPSLatitude"] + ["-tagsfromfile"] + ["@"] + ["-GPSLongitude"] + ["-tagsfromfile"] + ["@"] + ["-GPSAltitude"] + [newComment] + ["-overwrite_original"] + ["-P"] + ["-ThumbnailImage="] + [jpgFile])

    What a 3 day adventure. If you have a Samsung with this issue this should help.

    Big thanks to @StarGeek.

     
  • StarGeek

    StarGeek - 2022-09-30

    I would suggest using this to copy the GPS tags
    -TagsFromFile @ -GPS*
    For every GPS coordinate tag that is part of the EXIF group, there is a matching Ref tag, i.e. GPSLatitudeRef for GPSLatitude, GPSAltitudeRef for GPSAltitude. These are needed to indicate North/South/East/West/Above Sea Level/Below Sea Level. Plus there might be other GPS tags, such as direction of travel that would not get copied with your command.

    You also don't need a separate -TagsFromFile option for each tag. You just have to list them after -TagsFromFile

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.