ExifTool Forum

ExifTool => Newbies => Topic started by: John Addis on August 15, 2022, 03:48:35 PM

Title: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 15, 2022, 03:48:35 PM
My files are ordered by year and have been sequenced.
Most have data in the ImageDescription.

I would like to add the exif:ImageDescription  to the file name.
So the file 1999 JA_08400.jpg - one of many- would become
       file 1999 JA_08400_20 characters from exif.jpg

Files are stored on G:\PhotoMaster\Main\1999, so I would like to be able to add all files
under G:\PhotoMaster\Main\

I will copy G:\PhotoMaster\Main before running.  Updating should be in place.
That way the folders will be preserved.

IS it possible?  I can  not find where anyone has done it.
I have zero experience with exiftool.

John
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: StarGeek on August 15, 2022, 08:28:25 PM
Try this
exiftool "-TestName<%f $ImageDescription.%e" /path/to/files/

If the output looks correct, replace TestName with Filename to do the actual rename.

Files that don't have ImageDescription set will return an error and are skipped.
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 16, 2022, 09:07:20 PM
Dear StarGeek,

Sorry I did not get back to you sooner.  I thought I'd receive an email when someone answered.

I have tried, but to no avail
I used
exiftool "-TestName<%f $ImageDescription.%e" G:TEST/2001/"2001 JA_08760.jpg"
  had to put double quotes around my file name.
received
G:\TEST>exiftool "-TestName<%f $ImageDescription.%e" G:TEST/2001/"
2001 JA_08760.jpg"
Warning: Error opening file - G:TEST/2001/2001 JA_08760.jpg
Error: File not found - G:TEST/2001/2001 JA_08760.jpg
    0 image files updated

I wanted to process all files in this and other folders as one step.
Is it possibe?
What have I done wrong?  I do know nothing about exifTool!

John2022-08-16_204321.png2022-08-16_204820.png 
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: StarGeek on August 17, 2022, 10:33:09 AM
Quote from: John Addis on August 16, 2022, 09:07:20 PMSorry I did not get back to you sooner.  I thought I'd receive an email when someone answered.

Google, in their infinite wisdom  :P has decided that the simple SMTP process that this forum used to send email is no longer allowed (https://exiftool.org/forum/index.php?topic=13633.0).

Quoteexiftool "-TestName<%f $ImageDescription.%e" G:TEST/2001/"2001 JA_08760.jpg"
  had to put double quotes around my file name.

For whatever reason, exiftool can't find the file, thought the path looks correct.  Try putting quotes around the whole path and include the slash after the drive name
exiftool "-TestName<%f $ImageDescription.%e" "G:/TEST/2001/2001 JA_08760.jpg"

It doesn't matter whether you use forward or backward slashes in the file path because exiftool is written in Perl and Perl treats slashes in file paths the same.

Also, are you using CMD or PowerShell?  If the latter, use single quotes instead of double quotes.

If using CMD, you can also drag the file directly into the window to make sure the path is correct
(https://i.imgur.com/qR0a4Iv.gif)
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 17, 2022, 01:15:35 PM
Hi StarGeek,

I am on Windows 10.  I have trouble keeping up with it, but I am 81 years old.

Finally figured that since I had download exiftool, that I should place it in the Windows folder, after taking the -K from the right side.

Then I copied your text into the CMD window and I think it worked.
But it didn't update.


But how do I get it to work and update for every file in all the folders under TEST?

Sorry that I am so dumb.

John

Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: StarGeek on August 17, 2022, 02:03:29 PM
Did you change TestName into Filename after checking to see if the output listed the names correctly?
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 17, 2022, 02:20:41 PM
No,  I put it in, but

I must need more parameters.

I want it to scan and update all of TEST/all folders

John2022-08-17_141434.png2022-08-17_141832.png 
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: StarGeek on August 17, 2022, 11:16:30 PM
Uh, why are you putting a file path to the left of the less than sign?  You put either TestName to see what the renames would be, or Filename to do the actual renaming.

The -r (-recurse) option (https://exiftool.org/exiftool_pod.html#r-.--recurse) will process subdirectories

First run this
exiftool -r "-TestName<%f $ImageDescription.%e" G:/TEST/2001
and look at the output to see if it is correct.  Then run this to do the actual renaming
exiftool -r "-Filename<%f $ImageDescription.%e" G:/TEST/2001
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 17, 2022, 11:18:40 PM
StarGeek,

I found something that works
exiftool "-filename<%f $ImageDescription.%e" "G:/TEST/" dir -r

Is there another character than -r, to make EF scan sub-directories?
 
but the trouble is , if the ImageDesciption has a /, exiftool builds another directory.

The TEST folder had 3 folders 2017, 2018,2019.  I copied 3 files from 2017 and added the 3 same files to each folder.
The filename in error was 2017 JA_18720 John's flowers on 6/19/17.jpg, it started in folder 2017.

exiftool built a 2017 JA_ 18720 John's flowers on 6 directory, a 19 directory and moved the file into it, filename 17.jpg 2022-08-17_222205-small.jpg .
After the test the TEST folder had 4 folders.2022-08-17_222334-small.jpg2022-08-17_222432-small.jpg2022-08-17_222531-small.jpg2022-08-17_222622-small.jpg2022-08-17_222735-small.jpg2022-08-17_222847-small.jpg     
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 17, 2022, 11:29:07 PM
I put a file path to the left of the less than sign, because I don't know what I am doing.

I am going to try the copy you sent a few minutes ago, at 2315 EDST
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 18, 2022, 12:01:32 AM
Just tested exiftool -r "-TestName<%f $ImageDescription.%e" G:/TEST/2017

Changed 2001 since I am using some 2017 data.
Didn't work.  Nothing changed.  Maybe the -r goes on the right side?
Doesn't look like it tried the 2018 or 2019 folders.  That is why I used G:/TEST/ dir -r on the right side of the equation.
my test  exiftool "-filename<%f $ImageDescription.%e" "G:/TEST/" dir -r
  does dir make a difference?
2022-08-17_233919-medium.jpg
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: StarGeek on August 18, 2022, 10:19:54 AM
Quote from: John Addis on August 17, 2022, 11:29:07 PMI put a file path to the left of the less than sign, because I don't know what I am doing.

The text that is in a Monospace Brownish font is the exact command.  You would only replace the directory path where I put /path/to/files/ with the actual path you want to process

Quote from: John Addis on August 17, 2022, 11:18:40 PMIs there another character than -r, to make EF scan sub-directories?
 
but the trouble is , if the ImageDesciption has a /, exiftool builds another directory.

This is not a problem with -r, it's because of the slashes.  The position of the -r makes no difference.

The slash character is the part of Windows that indicates sub directories.  If there are slashes in the ImageDescription, they are telling exiftool to create subdirectories. 

Dealing with the slashes requires a slight change to the command. Braces and a semicolon need to be added to ImageDescription.  This will remove any special characters that Windows will treat differently
exiftool -r "-TestName<%f ${ImageDescription;}.%e" G:/TEST/2017
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 18, 2022, 10:56:06 AM
I see the image-desc has changed to  ${ImageDescription;}.%e
with the {;}  added.
Does that take care of the /, ?, $, and ", that are contained in the ImageDescription field?

I have been spending a lot time removing those from the imageDescription.
I used exiftool to make a list of all descs in csv format.  using Excel to find.
working on 3rd pass now.

John
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 19, 2022, 11:14:10 AM
StarGeek,

Thank YOU.

The ; takes out the special characters, but is there anything that replaces the special character  with a space?
So that John/Dick becomes John Dick, instead of JohnDick.
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 19, 2022, 01:27:52 PM
I have quit saving my photo descriptions to ImageDescripion  about 5 years ago.
I now add the description to the end of the filename.
I would like to get the filename inserted in the ImageDescription, for those 5 years.

I have tried, but failed,  copied parts from things written.
exiftool -r -P -overwrite_original -wm cg -progress -"ImageDescription< "G:/TEST/" dir
When it is run, I get:  "No file specified".

Could you show me exactly, how to write the spec?
Then I can copy it.
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: StarGeek on August 19, 2022, 08:25:40 PM
Quote from: John Addis on August 18, 2022, 10:56:06 AMDoes that take care of the /, ?, $, and ", that are contained in the ImageDescription field?

See the last paragraph under Advanced formatting feature (https://exiftool.org/exiftool_pod.html#Advanced-formatting-feature) for the list of characters removed.

Quote from: John Addis on August 19, 2022, 11:14:10 AMThe ; takes out the special characters, but is there anything that replaces the special character  with a space?
So that John/Dick becomes John Dick, instead of JohnDick.

That would require editing the command to specifically remove those characters.  It gets a bit more complicated
exiftool -r "-TestName<%f ${ImageDescription;tr/\/\\?*:|<>/ /}.%e" G:/TEST/2017

Quote from: John Addis on August 19, 2022, 01:27:52 PMI would like to get the filename inserted in the ImageDescription, for those 5 years.

Full filename including extension?  Or without extension?
This will write the full filename into the ImageDescription
exiftool -r -P -overwrite_original -wm cg -progress "-ImageDescription<Filename" G:/TEST/

If you want the filename without the extension, use Basename instead of Filename
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 19, 2022, 11:38:00 PM
THANK YOU, ThanK You, thank you!2022-08-19_101643-small.jpg

I will read the Advanced Formatting feature that you mention.

I have been trying to figure those things out.
I have spent many hours correcting those items, one at a time with ACDSee.
Did figure how to list all ImageDescription to csv, then Excel did some of the work.

my specs to list were (copied part what I saw else where)
exiftool -r "-filename<%f ${ImageDescription;}.%e" "G:/TEST/" dir

I used the following to convert, after hours with ACDSee.
exiftool -r -P -overwrite_original -wm cg -progress -"ImageDescription< "G:/TEST/" dir

Is there a way to only convert part of what is in the ImageDescription?
I cut all of my ImageDescription down to about 215 bytes, to allow for my original filename.
But I backed up the file before.

A sample of my output.
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 19, 2022, 11:41:35 PM
my output ended up on top instead of at the bottom.
may be because it told it to Preview after I uploaed the output?
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 20, 2022, 09:26:42 AM
StarGeek,

I would like to get the filename inserted in the ImageDescription, for those 5 years.

Full filename including extension?  Or without extension?
This will write the full filename into the ImageDescription
exiftool -r -P -overwrite_original -wm cg -progress "-ImageDescription<Filename" G:/TEST/

If you want the filename without the extension, use Basename instead of Filename


I tried, and the output looked OK.
2022-08-20_090848-small.jpg
 
But when I looked at the files, there was nothing in the IPTC  ImageDescription.  Or anything in IPTC?
2022-08-20_091720.png2022-08-20_091720-25%.jpg2022-08-20_091720-50%.jpg   

Also I used a color for what had been written, but what do you use for that?

Maybe I have figured out how to get my upload in the correct place - am testing.
Got it in the corret space, but couldn't delete two other attempts
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: StarGeek on August 20, 2022, 05:31:29 PM
Quote from: John Addis on August 20, 2022, 09:26:42 AMBut when I looked at the files, there was nothing in the IPTC  ImageDescription.  Or anything in IPTC?

That's because ImageDescription is not an IPTC tag.  It is part of the EXIF group and, IMO, not the best place to save description text. A lot of programs don't read that location.  A better place is either IPTC:Caption-Abstract, which is part of the older IPTC IIM/Legacy group, or XMP:Description, which is part of the newer IPTC Photo Metadata Standard (https://www.iptc.org/std/photometadata/specification/IPTC-PhotoMetadata), often called IPTC Core/Ext, though Description is technically Dublin Core.

QuoteAlso I used a color for what had been written, but what do you use for that?

You can either hit the "Quote" button at the bottom right

(https://i.imgur.com/eUwtI4h.png)


Or you can use the Quote button above the text box
(https://i.imgur.com/jYBOxCn.png)

The box to the left of that is the "Code" button which should be used for the output from exiftool.
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 20, 2022, 11:14:42 PM
Completely stumped.

I used ImageDescription to print all the contents to add to the file name, and that worked.
I then used ImageDescription to add to the filename.

Now I want to put later filenames into ImageDescription.

I tried  using ImageDescription, IPTC:Caption-Abstract,and XMP:Description.

These worked to an extent, each files Property Detail|Titles, has the filename in it.  It didn't before the test.

But none of the 3, changed anything that shows on ACDSee|Properties|IPTC|Description.  It is still blank.  In years before 2018, ACDSee|Properties|IPTC|Description  had the info that I converted to add to the filename.

I had entered the descriptions with Photoshop Elements and Lightroom before 2018.

What am I doing wrong?

Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 20, 2022, 11:53:18 PM
In the above post I used

exiftool -r -P -overwrite_original -wm cg -progress "-ImageDescription<Basename" G:/TEST/


I tried  using ImageDescription, IPTC:Caption-Abstract,and XMP:Description, all with the same result.
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 21, 2022, 04:46:24 AM
Tried
exiftool -r -P -overwrite_original -wm cg -progress "-exif:imagedescription<Basename" G:/TEST/

exif:imagedescription was used by Phil Harvey
Still no good result
2022-08-21_041244 phils image.png

I know nothing about the formula, I only copy and test.
Will exiftool never do it, or is there something wrong in the formula?
 
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: StarGeek on August 21, 2022, 12:30:02 PM
The -wm (-writeMode) option (https://exiftool.org/exiftool_pod.html#wm-MODE--writeMode) you have set will not overwrite existing tags.  With -wm cg, you will only write if a tag needs to be created.  Remove -wm cg if you want to change and overwrite the contents of a tag with new data.
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 22, 2022, 10:41:11 PM
I used
2022-08-22_221404  1 used-medium.jpg
After the update
2022-08-22_221431 2 after update.png

ACDSee after the update
2022-08-22_221112 3 acdsee-medium.jpg

Looked good, but nothing changed.

imagedescription is a good keyword, because I used it to extract the original descriptions.

imagedescription is good to copy from, but I can not copy to it.

Phil might know why or how?


 
 
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: Phil Harvey on August 23, 2022, 06:34:29 AM
This looks like FAQ 3 (https://exiftool.org/faq.html#Q3).

I can't speak for what ACDSee will read.

- Phil
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: StarGeek on August 23, 2022, 10:50:51 AM
Did you refresh the metadata after editing?  If I recall, there's either a menu option or a right click context menu option, something like Metadata->Read from file

That said, I can't offer any other advice when it comes to what tags ACDSee reads other than I know it does read IPTC:Caption-Abstract and XMP:Description.  I tried it once and disliked it so much I had to uninstall it after a couple days.
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 23, 2022, 01:47:25 PM
Phil & StarGeek,

In about 2002 I using on Photoshop.
After about 10 years, PhotoShop was too expensive, so I started using Photoshop
Elements.  Then on Lightroom for 1 year in 2016. Went to Elements in 2017, instead of the monthly cost of Lightroom. This July I wanted to upgrade again, but the junior programmers at Adobe had totally fowled it up! I restored my backup.
I had tried ACDSee in 2017, but Elements was far better.  I was surprised when I tried the new ACDSee.  I bought it.

I cut my test run to 2 files,  all from before 2017.
After reading the faq #3, I inserted a -v2 in the file spec.

exiftool -r -P -v2 -overwrite_original -wm wcg -progress "-exif:imagedescription<Basename" G:/TEST/
Test 2022-08-23.txt
!
exiftool updated something!

I don't know what.
  It was not in what Adobe Elements calls General-Caption, where I always entered the imagedescription (one of the few semi-automatic fields).
 
It is not in ACDCee IPTC Description.  That is where I have each description, for the entire file. I can see those from Photoshop, Lightroom, Elements, and ACDSee.

Years ago, I read that Adobe puts the Description in 3 places.  One of the places is where exiftoolf finds it and probably replaces it.  One other is Where ACDSee uses it as a IPTC Description.  The other must where Adobe stores it for General-Caption.

What a mess.  Are you aware of a program that prints all user data from a jpg?

Is there another FieldName (not imagedescription) for what might be called AdobeGeneralCaption?

Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 23, 2022, 02:11:08 PM
Guess I can't upload a file, here is 2 jpg's.
The second file is better to look at.
2022-08-23_140111-medium.jpg
2022-08-23_140140-medium.jpg 
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: Phil Harvey on August 23, 2022, 02:15:06 PM
ExifTool is updating IFD0:ImageDescription as you specified.  The problem is that ACDSee isn't reading this.  This is more of an ACDSee issue.

- Phil
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 23, 2022, 02:50:07 PM
I now know that ACDSee isn't finding it, but neither will Elements.  I checked the last item I tested  - 2016 JA_18370.jpg with Elements 2018 and it's Caption was the same as before the test, should have been 2016 JA_18370.  I had copied it backup before any changes were made, so it did not have the ItemDescription as part of the Filename.

So neither Elements or ACDSee could find it.  I suspect that Photoshop or Lightroom, might be able to find  IFD0:ImageDescription.  Whether it could be available me without going thru a bunch of menus, but I can not afford them.

XnViwMP does not show the value of  IFD0:ImageDescription.

Any way to send you the test file 2016 JA_18370.jpg? and you could find where IFD0 is?
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 23, 2022, 03:26:53 PM
Now I know sort of where IFD0 put the imagedescription.
  In the properties file for the file, but not where I could find it.2022-08-23_151904-small.jpg
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 23, 2022, 09:36:14 PM
More research.

I changed the test file name to 2016 JA_18370 test 08-23 -- x.
I ran exiftool
2022-08-23_192037 exiftool updating-50%.jpg

ONLY change was in the file properties.
2022-08-23_184639 file property after-50%.jpg
I had downloaded an IPTC-XMP program and ran it on the test file before and after.

Nothing changed on IPTC or XMP, so I only show one set of photographs.
This is where the IPTC data is located (IPTC(7) Descr)
2022-08-23_190326 IPTC in layout-50%.jpg

This is what I changed it to, and it stayed the same after exiftool.
2022-08-23_185555 IPTC(7) Caption-Abstract-50%.jpg

This is where the XMP-dc data is located (XMC-dc 201)
2022-08-23_190544 XMP-dc in layout-50%.jpg

This is what I changed it to, and it stayed the same after exiftool.
2022-08-23_205127 XMP-dc Description-50%.jpg

Ran Elements after
2022-08-23_190957 Elements IPTC after-50%.jpg

Ran ACDSee after
2022-08-23_191432 ACDSee IPTC after-50%.jpg

The filename had not been inserted, anywhere.
There was no evidence that XMP-dc was ever used.
BUT the Descriptions had IPTC(7) in front portion, the same as before.

Perhaps, ImageDescription could update 3 fields, instead of the two that it now updates? (Property-Titles, Property-Subject, & IPTC-Caption-Abstract)

I have copied the descriptions from all my filenames to the IPTC description.  ACDSee lets me copy-change the filename and post it to the IPTC Description.
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: StarGeek on August 24, 2022, 12:35:40 AM
Quote from: John Addis on August 23, 2022, 09:36:14 PMPerhaps, ImageDescription could update 3 fields, instead of the two that it now updates? (Property-Titles, Property-Subject, & IPTC-Caption-Abstract)

Writing to ImageDescription will only create/update the EXIF:ImageDescription and will update the XMP:ImageDescription if it exists, which is unlikely as it is a rarely used tag.  It will not update any other tag.

See this post (https://exiftool.org/forum/index.php?topic=6591.msg32875#msg32875) for what tags Windows will read/write in the Properties->Details window.
Title: Re: How to insert exif:ImageDescription as addition to the FileName
Post by: John Addis on August 24, 2022, 04:42:30 AM
StarGeek,

Thank you for helping/DOING the work to transfer what I thought, was the description that I see in IPTC.  Now that I know that ADOBE does put the description in 3 places.  ImageDescription copied the Properties File Description, and also replaced it.

Then there is not a way to replace the IPTC Description.

Then it is a good thing that I used ACDSee to update the remaining IPTC Descriptions.

 Lightroom did well on the IPTC Description, it is too bad that it is an annual pay product.  Wonder why Adobe does not discount to seniors, as well as students?