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
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
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.
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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
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
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.
Hopefully this works https://ars-usda.box.com/s/etept1ktkep4xkdbu629sc6o2i1fch9z
thanks
There are a lot of problems with that file
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.
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!
I'm guessing the two warnings are
Undefined value for ExifIFD:DigitalZoomRatio
andUnknown 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.
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!
The very last post was added this morning. I hate necro-posting, but it was appropriate for that thread.
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
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
Remove
-exif:all=
That's what is stripping the EXIF data. All you need to do to fix it is remove the thumbnail.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 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
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 the1 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.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.
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
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.
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
forGPSLatitude
,GPSAltitudeRef
forGPSAltitude
. 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