News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Help with command in removing EXIF for images.

Started by pras92, February 04, 2020, 12:54:04 AM

Previous topic - Next topic

pras92

Hello,

I come from here: https://www.reddit.com/r/googlephotos/comments/8p2k1u/the_complicated_way_to_sort_pictures_based_on_the/

I'm trying to remove all meta data for my pictures (retaining only the filename and image data), to overcome the lack of 'sort by filename' feature in Google Photos.

The post says to place the exiftool.exe in C:\ and create a BAT file in the work folder where the images are,
QuoteC:\exiftool.exe -k -overwrite_original -d %%Y%%m%%d%%H%%M%%S%%%%-c.%%%%e -all= .

Double clicking on this file now will erase all image's metadata contained in the same folder your script / BAT file is.

This is all i get
Quote1 directories scanned
    0 image files updated
    2 image files unchanged

Can you help me with the right command for my purpose of deleting all possible dates in a picture?
Thank you.

StarGeek

Are you sure that there is any metadata that needs to be removed?  While the -d %%Y%%m%%d%%H%%M%%S%%%%-c.%%%%e part is completely unnecessary, the -all= is the part that removes all the embedded metadata.  According to the output, there wasn't anything there in the first place.

You can double check by doing this.  Create another batch file with this command, put it in the same directory, and then run it.
exiftool -a -s -g1 -iptc:all -xmp:all -Exif:all .
That will list the metadata that can be cleared.  If nothing shows up except a line of equal signs and the file name, similar to this
======== y:/!temp/Test4.jpg
Then the data has already been removed.


* 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).

pras92

Quote from: StarGeek on February 04, 2020, 01:23:55 AM
Are you sure that there is any metadata that needs to be removed?



QuoteWhile the -d %%Y%%m%%d%%H%%M%%S%%%%-c.%%%%e part is completely unnecessary, the -all= is the part that removes all the embedded metadata.

The OP in the above reddit post mentioned that there could be a dozen of date fields that might be used by GPhotos to sort pictures, and i believed that long string made sure to strip all numbers that's in time/date format. Thanks for simplifying the command but, may i know for what that string could be used, or is that redundant with exiftool?

I slightly changed your suggested command to make it work for me and, you're right. It displays only the filename as below:

D:\1>C:\exiftool.exe -k -a -s -g1 -iptc:all -xmp:all -Exif:all .
======== ./file1.png
======== ./file2.png
    1 directories scanned
    2 image files read


So, is there any way to remove the date shown in the pic above?

Thank you for your time and support.

Phil Harvey

Quote from: pras92 on February 04, 2020, 02:37:33 AM
may i know for what that string could be used

It specifies the date/time format when reading or writing a date/time value.  It isn't used when just deleting tags.

QuoteSo, is there any way to remove the date shown in the pic above?

The dates shown must be the filesystem date/times, and not metadata in the file.  To reset these to the current date/time, as well as delete all metadata, you could do this:

C:\exiftool.exe -k -overwrite_original -all= -filemodifydate=now -filecreatedate=now .

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

StarGeek

Phil is correct.  All the info shown on the General tab of the properties window are properties of the underlying filesystem.  These items cannot be removed.  Well, other than by deleting the file ;)

One other thing to mention is that you don't need to strip all metadata from a file to sort it on Google Photos.  All you have to do is set the DateTimeOriginal on all the images to a specific time, then run the command that includes FileSequence, except use DateTimeOriginal as the target instead.

So you could change your bat file to this instead
exiftool -overwrite_original "-DateTimeOriginal=now" .
exiftool -overwrite_original -f"-DateTimeOriginal+<0:0:$FileSequence" .


And you would get the sorting you wanted without needing to remove all the metadata.
* 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).

pras92

Quote from: StarGeek on February 04, 2020, 12:10:26 PM
All the info shown on the General tab of the properties window are properties of the underlying filesystem.  These items cannot be removed.

Understood. Thank you both.

QuoteOne other thing to mention is that you don't need to strip all metadata from a file to sort it on Google Photos.  All you have to do is set the DateTimeOriginal on all the images to a specific time, then run the command that includes FileSequence, except use DateTimeOriginal as the target instead.
Okay, further digging into my 40k files (just the first batch of the lot), i see that the "Modified" value under Properties>General Tab has the value that i want to be considered for sorting purposes. So i copied the "Modified" to "Created" in General Tab. The value under Properties>Details Tab> Origin> Date Taken is still empty, FYI.

So, instead of using DateTimeOriginal like you suggested, i'd like to use fileCreateDate. I tried using both, interchanging between these two formats:
exiftool -overwrite_original -f"-DateTimeOriginal+<0:0:$FileSequence" .
exiftool -overwrite_original "-file:fileCreateDate+<0:0:$filesequence" .

but get this same error:

Warning: No writable tags set from ./f1.png
Warning: Invalid tag name '0:0:' - ./f1.png

1 directories scanned
    0 image files updated
    1 image files unchanged


You had suggested to use -m in another post to ignore errors for No writable tags set, no change in the result in this case.
And I couldn't find anything specifically for Invalid tag name '0:0:'

How should i proceed?

Phil Harvey

Quote from: pras92 on February 11, 2020, 03:35:09 AM
exiftool -overwrite_original -f"-DateTimeOriginal+<0:0:$FileSequence" .

The "-f" should be removed from this command.

Quoteexiftool -overwrite_original "-file:fileCreateDate+<0:0:$filesequence" .

I tried this, and it works for me in Windows.  But note that the FileCreateDate of the first file won't be changed because FileSequence starts at 0.

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

pras92

Tried removing -f from the first code. Both command still yields the same result for me, unfortunately.  :'(

c:\exiftool.exe -overwrite_original "-DateTimeOriginal+<0:0:$FileSequence" .
Warning: No writable tags set from ./d1.jpg
Warning: Invalid tag name '0:0:' - ./d1.jpg
Warning: No writable tags set from ./d2.jpg
Warning: Invalid tag name '0:0:' - ./d2.jpg
    1 directories scanned
    0 image files updated
    2 image files unchanged

c:\exiftool.exe -overwrite_original "-file:fileCreateDate+<0:0:$filesequence" .
Warning: No writable tags set from ./d1.jpg
Warning: Invalid tag name '0:0:' - ./d1.jpg
Warning: No writable tags set from ./d2.jpg
Warning: Invalid tag name '0:0:' - ./d2.jpg
    1 directories scanned
    0 image files updated
    2 image files unchanged



Using Powershell in Win10. Used different set of files too.
Since it works fine for you, it must be something else in my end. I'll try to do this in a different computer.


Can you kindly sample with the same files i'm doing?  I've attached a zip with 2 jpgs. If you can confirm it's successful with my files, that'd be great. Thank you.

Phil Harvey

You must be using a very old version of ExifTool.  Try updating to the current version.

Either that or you are using PowerShell or some other crappy shell.  Try using cmd.exe if this is the case.

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

StarGeek

Quote from: pras92 on February 11, 2020, 11:35:32 AM
Using Powershell in Win10. Used different set of files too.

Use CMD, not Powershell.  PS has a rule set all it's own, different from CMD, and it doesn't interact very well with exiftool.
* 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).

pras92

Quote from: Phil Harvey on February 11, 2020, 11:57:15 AM
Either that or you are using PowerShell or some other crappy shell. 
PowerShell indeed was a crappy shell. Using CMD, both the codes didn't threw any error, and this one run successfully.
c:\exiftool.exe -overwrite_original "-file:fileCreateDate+<0:0:$filesequence" .
    1 directories scanned
    1 image files updated
    1 image files unchanged

As you said previously, the fileCreateDate of the 1st file was left out understandably, and that's no issue. Thanks a lot for your help and for creating this tool.

Quote from: StarGeek on February 11, 2020, 12:07:47 PM
Use CMD, not Powershell.  PS has a rule set all it's own, different from CMD, and it doesn't interact very well with exiftool.
I preferred PowerShell because it let me open the terminal from any work folder without having to use cd like in CMD. I guess i'll stick with CMD from now on.
Thank you, you're really supportive with questions that will seem too basic for an experienced user like you. Forum Mods like you are the reason wonderful opensource tools like exiftool are a lot more user friendly for new users. I'll need to test some more but now that i've executed a command successfully, this has got me started somewhere.