Skip to content

Instantly share code, notes, and snippets.

@yutsuku
Last active January 27, 2024 18:45
Show Gist options
  • Save yutsuku/4a05127d08129987379ad200cfea8be9 to your computer and use it in GitHub Desktop.
Save yutsuku/4a05127d08129987379ad200cfea8be9 to your computer and use it in GitHub Desktop.
Issue 2
=======
Some (but not all) photos taken by Samsung SGH-E260 have
EXIF tag DateTimeOriginal formated wrong (2009:1212:12 16:21:3)
as reported by
exiftool -n -s .\badfile.jpg
and other various photo viewers with EXIF support (Honeyview, Irfranview)
Steps of action
===============
All commands are being executed by PowerShell on Windows 10
-----------------------------------------------------------
Copy ALL files taken by that camera to new folder in order to repair
using the following command (using regex cause eq did not work)
exiftool -o . -P -r -if '$make =~ /SAMSUNG/i and $model =~ /SGH\-E260/i' -directory='corrupted/%d' .
Try to autofix EXIF tags
========================
Get-ChildItem -path 'corrupted/' -Recurse | foreach {exiftool -all= -tagsfromfile `@ -all:all -unsafe -icc_profile $_.FullName}
Some files returned the following error for me:
Error: JPEG EOI marker not found - badfile.jpg
0 image files updated
1 files weren't updated due to errors
Solution to it was re-save the file from graphic editor (Photoshop in my case)
and run the command on single files:
exiftool -all= -tagsfromfile `@ -all:all -unsafe -icc_profile badfile.jpg
If your software can't read the file at all, you're out of luck most likely
Remove unneccessary files created by exiftool
=============================================
Get-ChildItem -Path 'corrupted/' -Include *_original -File -Recurse | foreach { $_.Delete()}
Move all files from corrupted up one level by ctrl+a/ctrl+x and ctrl+v like a savage
Continue with normal workflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment