Author Topic: Captions, Descriptions, Titles, Picasa and Windows  (Read 11269 times)

deb27

  • Jr. Member
  • **
  • Posts: 14
Captions, Descriptions, Titles, Picasa and Windows
« on: July 06, 2015, 04:32:45 PM »
I recently discovered that Picasa Captions and Windows file properties do not play well together for JPG files...which is what brought me here.
My goal is to get the captions which I create in Picasa (which are viewable in my online google photo albums) to appear in the Windows File properties Details tab.  Unfortunately Picasa does not always do this for me. 

In my case, my camera has the unfortunate feature in which it writes the text "OLYMPUS DIGITAL CAMERA"  into the Exif:ImageDescription, Xmp:Description and Iptc:Caption-Abstract fields.  And this apparently triggers Picasa to not write the caption to the field(s) that windows uses for "Title" in the file properties.
Anyone wishing to understand the details of that confusing sentence, take a look here:
https://productforums.google.com/d/msg/picasa/GGnwSlb2ULM/LpSaKPT3lNIJ

So...my solution (which I'd love some help with) is as follows:

Write a script which does the following

Code: [Select]
--First get rid of all the junk that my camera inserted in the fields that I don't want
for each JPG photo in my directory
  if Exif:ImageDescription = "OLYMPUS DIGITAL CAMERA"
    delete this text from the field
  if Xmp:Description = "OLYMPUS DIGITAL CAMERA"
    delete this text from the field
  if Iptc:Caption-Abstract= "OLYMPUS DIGITAL CAMERA"
    delete this text from the field
end loop

--Now that the fields are cleared out (such that future captions created with Picasa will be written properly to the exif),
--go through all the files and put the captions I've already created into the field(s) that windows will display as Title and/or Subject

for each JPG file in the same directory
  if Iptc:Caption-Abstract is not null/empty
    copy the value from Iptc:Caption-Abstract into Exif:ImageDescription
    copy the value from Iptc:Caption-Abstract into Xmp:Description
  end if
end loop

My problem is that while I do have a programming background, I have no experience with Perl. Do I need it?
I am running Windows 7

Many thanks to all of you and incredible gratitude to the creators and supporter of ExifTool and ExifToolGUI without which I'd probably be stuck with a metadata disaster.

Note: in case someone wonders why I am copying Iptc:Caption-Abstract to both Exif:ImageDescription and Xmp:Description it's because, despite numerous test cases, I can't figure out which one Windows uses to populate the Title field. It seems somewhat random. So I just figured I'd do both of them.
 

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17190
    • ExifTool Home Page
Re: Captions, Descriptions, Titles, Picasa and Windows
« Reply #1 on: July 06, 2015, 05:09:35 PM »
You don't need programming experience.  ExifTool will do this with two commands:

Code: [Select]
--First get rid of all the junk that my camera inserted in the fields that I don't want
for each JPG photo in my directory
  if Exif:ImageDescription = "OLYMPUS DIGITAL CAMERA"
    delete this text from the field
  if Xmp:Description = "OLYMPUS DIGITAL CAMERA"
    delete this text from the field
  if Iptc:Caption-Abstract= "OLYMPUS DIGITAL CAMERA"
    delete this text from the field
end loop

exiftool -Exif:ImageDescription-="OLYMPUS DIGITAL CAMERA" -Xmp:Description-="OLYMPUS DIGITAL CAMERA" -Iptc:Caption-Abstract-="OLYMPUS DIGITAL CAMERA" -ext jpg DIR

Code: [Select]
for each JPG file in the same directory
  if Iptc:Caption-Abstract is not null/empty
    copy the value from Iptc:Caption-Abstract into Exif:ImageDescription
    copy the value from Iptc:Caption-Abstract into Xmp:Description
  end if
end loop

exiftool "-Exif:ImageDescription<Iptc:Caption-Abstract" "-Xmp:Description<Iptc:Caption-Abstract" -ext jpg DIR

- Phil

Edit: Added missing "-"
« Last Edit: July 07, 2015, 07:13:55 AM by Phil Harvey »
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 4209
Re: Captions, Descriptions, Titles, Picasa and Windows
« Reply #2 on: July 06, 2015, 07:56:03 PM »
Windows file properties don't play well with anything.

I decide to take a few minutes and figure this out, since this info doesn't seem to be documented anywhere from what I can tell.

When you set the Title from Windows Properties, the following tags are set:
  • EXIF:ImageDescription
  • EXIF:XPTitle
  • IPTC:Caption-Abstract
  • XMP:Description
  • XMP:Title

Windows Properties will populate the Title with the same tags, in this order of priority:
  • XMP:Title
  • EXIF:ImageDescription
  • IPTC:Caption-Abstract
  • XMP:Description
  • EXIF:XPTitle

Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

deb27

  • Jr. Member
  • **
  • Posts: 14
Re: Captions, Descriptions, Titles, Picasa and Windows
« Reply #3 on: July 06, 2015, 10:11:43 PM »
Thanks StarGeek!  I haven't been able to find that info anywhere so I'm glad you documented it.  I'll add to what you wrote:

When you set the Subject field from Windows Explorer -> Properties->Details the following tag is set:
  • EXIF:XPSubject
Windows details will populate the Subject field using the following fields (in priority order)
  • EXIF:XPSubject
  • EXIF:ImageDescription

The Comment field in windows details is apparently simple.
Setting the Comment field sets the tag:
  • EXIF:XPComment
and that is the only field used for displaying the comment

Note: this was tested with Windows 7. Results for other versions of windows may be different.

deb27

  • Jr. Member
  • **
  • Posts: 14
Re: Captions, Descriptions, Titles, Picasa and Windows
« Reply #4 on: July 06, 2015, 10:25:09 PM »
Phil, this is totally awesome! Thank you so very much for your response.  I tested it out and i think it solves the problem completely. Note: there is a minor typo in the second command, the dash(-) is missing prior to Xmp. Correct version is:
Code: [Select]
exiftool "-Exif:ImageDescription<Iptc:Caption-Abstract" "-Xmp:Description<Iptc:Caption-Abstract" -ext jpg DIR
I just have a couple of minor questions.  I got a lot of "Warning: No writable tags are set from <filename>"
I assume that message appears when there is nothing for it to copy?
Is there a way to route the warnings to an output file? I added ">outputfile.txt" in order to capture the output of the command in a file but it doesn't capture the warnings. Is it possible to capture all warnings and errors in the output file too?

What does "Warning: [minor] Error reading PreviewImage from file - <filename>" mean?
How about "Warning: [minor] Fixed incorrect URI for xmlns:MicrosoftPhoto - <filename>

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17190
    • ExifTool Home Page
Re: Captions, Descriptions, Titles, Picasa and Windows
« Reply #5 on: July 07, 2015, 07:20:56 AM »
there is a minor typo in the second command, the dash(-) is missing prior to Xmp.

Thanks.  I've edited my original post to fix this.

Quote
I got a lot of "Warning: No writable tags are set from <filename>"
I assume that message appears when there is nothing for it to copy?

Yes.

Is there a way to route the warnings to an output file? [/quote]

Somebody recently asked the same question

Quote
Is it possible to capture all warnings and errors in the output file too?

You can send both stdout and stderr to the same file, like this:  > out.txt 2>&1

Quote
What does "Warning: [minor] Error reading PreviewImage from file - <filename>" mean?

Likely the image has been edited and the preview has been removed.

Quote
How about "Warning: [minor] Fixed incorrect URI for xmlns:MicrosoftPhoto - <filename>

The Microsoft software is extremely buggy.  ExifTool fixes some of their metadata errors when it can.

- Phil

P.S. I've added a sticky post in the Metadata section with the results of your Windows metadata tests.
« Last Edit: July 07, 2015, 01:32:04 PM by Phil Harvey »
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

deb27

  • Jr. Member
  • **
  • Posts: 14
Re: Captions, Descriptions, Titles, Picasa and Windows
« Reply #6 on: October 06, 2015, 11:15:19 PM »
I just tried to run through this process again and now it doesn't work.
I can't get the command which removes the text from the ImageDescription tag to work.

Here's what happens. First, I displayed the values in the tags.  Here's a snippet of that output

Code: [Select]
D:\pictures\2015\temp>exiftool -a -G1 -s 20150907-Scotland-0025.jpg
[ExifTool]      ExifToolVersion                 : 9.98
[System]        FileName                        : 20150907-Scotland-0025.jpg
[System]        Directory                       : .
[System]        FileSize                        : 1642 kB
[System]        FileModifyDate                  : 2015:09:07 16:36:36-04:00
[System]        FileAccessDate                  : 2015:10:06 22:49:11-04:00
[System]        FileCreateDate                  : 2015:10:06 22:49:11-04:00
[System]        FilePermissions                 : rw-rw-rw-
[File]          FileType                        : JPEG
[File]          FileTypeExtension               : jpg
[File]          MIMEType                        : image/jpeg
[File]          ExifByteOrder                   : Little-endian (Intel, II)
[File]          ImageWidth                      : 3200
[File]          ImageHeight                     : 2400
[File]          EncodingProcess                 : Baseline DCT, Huffman coding
[File]          BitsPerSample                   : 8
[File]          ColorComponents                 : 3
[File]          YCbCrSubSampling                : YCbCr4:2:2 (2 1)
[IFD0]          ImageDescription                : OLYMPUS DIGITAL CAMERA
[IFD0]          Make                            : OLYMPUS IMAGING CORP.
...

Next I tried to clear out the data that's in the ImageDescription tag. Here's what happened:
Code: [Select]
D:\pictures\2015\temp>exiftool -Exif:ImageDescription-="OLYMPUS DIGITAL CAMERA" 20150907-Scotland-0025.jpg
    0 image files updated
    1 image files unchanged
Then I tried:
Code: [Select]
D:\pictures\2015\temp>exiftool -IFD0:ImageDescription-="OLYMPUS DIGITAL CAMERA" 20150907-Scotland-0025.jpg
    0 image files updated
    1 image files unchanged
Since I couldn't get the "-=" to work, I tried to simply delete the data. Like this:
Code: [Select]
D:\pictures\2015\temp>exiftool -IFD0:ImageDescription="" 20150907-Scotland-0025.jpg
    1 image files updated
Well that deleted the data but I really want the "-=" to work because I don't want to remove the value when it's not equal to "OLYMPUS DIGITAL CAMERA"

Out of curiosity, I wondered if there was some kind of special characters in that string that I couldn't see so I manually reset the tag to contain "OLYMPUS DIGITAL CAMERA" and then tried the "-=" operator to delete it and this time the deletion worked!  See below:
Code: [Select]
D:\pictures\2015\temp>exiftool -IFD0:ImageDescription="OLYMPUS DIGITAL CAMERA" 20150907-Scotland-0025.jpg
    1 image files updated

D:\pictures\2015\temp>exiftool -IFD0:ImageDescription-="OLYMPUS DIGITAL CAMERA" 20150907-Scotland-0025.jpg
    1 image files updated

So...why didn't the "-=" operator work in the first place? Clearly it wasn't matching the string "OLYMPUS DIGITAL CAMERA" even though I can't see any discrepancies in the text.  I'm still using the same camera that I used the last time I tried this. And I haven't updated the software on my PC. So I have no idea what changed.

I'm baffled. Thanks for any help you can provide.





StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 4209
Re: Captions, Descriptions, Titles, Picasa and Windows
« Reply #7 on: October 06, 2015, 11:58:58 PM »
Try
ExifTool -Exif:ImageDescription-="OLYMPUS DIGITAL CAMERA         " FILEorDIR

Olympus cameras pad the ImageDescription with nine extra spaces.

Edit:   If something doesn't seem to be working right, I'll add the -php option to the command.  It'll often show you parts of the tag that aren't necessarily obvious.  For example, in this case it shows "ImageDescription" => "OLYMPUS DIGITAL CAMERA         "-json option is another choice that may help
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

deb27

  • Jr. Member
  • **
  • Posts: 14
Re: Captions, Descriptions, Titles, Picasa and Windows
« Reply #8 on: October 07, 2015, 11:29:10 AM »
Thanks StarGeek.
I used -php as follows:
Code: [Select]
exiftool -a -G1 -s -php filename.jpgand got
Code: [Select]
"IFD0:ImageDescription" => "OLYMPUS DIGITAL CAMERA         ",So you are definitely correct about the trailing spaces.  Your solution of adding the 9 spaces
Code: [Select]
exiftool -Exif:ImageDescription-="OLYMPUS DIGITAL CAMERA         " filename.jpgto the original command worked great. Thank you very much.

But that leads to another question. Is there any way to make this more robust? I.e. a script that would do the following:
Code: [Select]
if the ImageDescription tag contains "OLYMPUS" then clear the tag, otherwise leave it alone
Back in July when I wrote the original post, I didn't seem to have the "9 trailing spaces" problem. I have no idea why I have it now. Therefore making the commands (or script) more robust would reduce the possibility that every time I want to fix the tags I have to go figure this out all over again.

Many thanks for the swift reply!!!

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17190
    • ExifTool Home Page
Re: Captions, Descriptions, Titles, Picasa and Windows
« Reply #9 on: October 07, 2015, 11:44:19 AM »
Is there any way to make this more robust? I.e. a script that would do the following:
Code: [Select]
if the ImageDescription tag contains "OLYMPUS" then clear the tag, otherwise leave it alone

There are a few ways to do this:

1) Use the -if option to process only files with the specified condition:

exiftool -if  "$imagedescription =~ /OLYMPUS/" -imagedescription= DIR

(The disadvantage here is that you would have to do your other processing in a separate command.)

2) Create a Composite user-defined tag that returns the value of ImageDescription only if it does not contain "OLYMPUS", then delete the image description and copy this tag back into ImageDescription.

exiftool -config my.config -imagedescription= "-imagedescription<myimagedescription" DIR

(The disadvantage here is that creating and using the config file is a pain.  Also, the file will get rewritten even if nothing needs to be changed.)

3) Do the same thing with the advanced formatting feature:

exiftool -imagedescription= "-imagedescription<${imagedescription;/OLYMPUS/ and $_=undef}" DIR

(No config file needed, but the command line is rather cryptic.)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

deb27

  • Jr. Member
  • **
  • Posts: 14
Re: Captions, Descriptions, Titles, Picasa and Windows
« Reply #10 on: October 07, 2015, 12:29:33 PM »
Got it!  Thank you so very much.  So here's the final summary with the commands I opted to use so that the next poor soul who has to deal with this issue doesn't have to fish it all out of this thread:

First, just for grins, check the value stored within the ImageDescription tag in the jpg files:
Code: [Select]
exiftool -a -G1 -s -php filename.jpg
Remove “OLYMPUS DIGITAL CAMERA” from ImageDescription, Description and Caption-Abstract
Code: [Select]
exiftool -if  "$imagedescription =~ /OLYMPUS/" -imagedescription= DIR
exiftool -if  "$Xmp:Description  =~ /OLYMPUS/" -Xmp:Description= DIR
exiftool -if  "$Caption-Abstract =~ /OLYMPUS/" -Caption-Abstract= DIR

If captions had already been created in Picasa, the metadata needs to be updated to put that caption in the proper fields:
Code: [Select]
exiftool "-Exif:ImageDescription<Iptc:Caption-Abstract" "-Xmp:Description<Iptc:Caption-Abstract" -ext jpg DIR
where DIR is the directory containing the files (or ‘.’ for current directory)

Having done all that, I finally have Picasa captions in the correct fields so that looking at the Windows Properties on the file will show me the Caption in the Title field. Whew!

mphanet

  • Newbie
  • *
  • Posts: 1
Re: Captions, Descriptions, Titles, Picasa and Windows
« Reply #11 on: December 17, 2016, 12:01:58 PM »
The problem with the solution is that the original files were saved so another step must be done to delete the files.  Wonder if there's an option *not* to save the original files.

Hayo Baan

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 1140
  • Professional Photographer & Software Developer
    • Hayo Baan – Photography
Re: Captions, Descriptions, Titles, Picasa and Windows
« Reply #12 on: December 17, 2016, 01:58:03 PM »
I think you mean -overwrite_original. With that option, the original file will be overwritten.
Hayo Baan – Photography
Web: www.hayobaan.nl