Copy Comment into XP Comment

Started by hubertd, April 27, 2024, 04:20:44 PM

Previous topic - Next topic

hubertd

Hi

Sorry this is probably a too simple question - but I have been too long in help and sample section and searching this forum. 

I have a good bunch of files with useful comments in the Comment field. Would like to copy them into the XP Comment field. Added complexity: it may need editing prior to re-import for codepage issues.

Q1: how can I export just the Comment field of many photos into a single file? (I spare you the examples of what I tried already)

Q2: once I have edited the output file (assuming it will be UTF8 - by then) how could I copy that information into the photos and how do I specify the character set (UTF8 wanted)?

Q3: I hope length of comment is no issue. Some comments are 400 chars.


Here is an example output of a photo in question

D:\Bilderschau>exiftool bild003.jpg
ExifTool Version Number         : 12.83
File Name                       : bild003.jpg
Directory                       : .
...
Exif Byte Order                 : Big-endian (Motorola, MM)
XP Comment                      : Test Kommentar
Comment                         : Fischgrenze zwischen Neuburg und Joshofen an der gro▀en Grotte


Thanks for any hints and help
Hubert

Phil Harvey

Hi Hubert,

Quote from: hubertd on April 27, 2024, 04:20:44 PMQ1: how can I export just the Comment field of many photos into a single file?

With no other information?  Here you go:

exiftool -s3 -comment DIR > out.txt


QuoteQ2: once I have edited the output file (assuming it will be UTF8 - by then) how could I copy that information into the photos and how do I specify the character set (UTF8 wanted)?

OK.  So you want to copy it back again.  Then the last command should have been:

exiftool -csv -comment DIR > out.csv

Then to copy the edited comments back again into the same files:

exiftool -csv=out.csv DIR

UTF-8 is the default character set, so you're good here.  Sort of.  The JPEG Comment doesn't have a specified encoding so other apps may not handle special characters properly.

QuoteQ3: I hope length of comment is no issue. Some comments are 400 chars.

The limit is about 65000 characters for Comment.

- 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: hubertd on April 27, 2024, 04:20:44 PMAdded complexity: it may need editing prior to re-import for codepage issues.

From the EXIF Tags page, listed under XPTitle but applies to all the Windows specific XP* tags
Quotetags 0x9c9b-0x9c9f are used by Windows Explorer; special characters in these values are converted to UTF-8 by default, or Windows Latin1 with the -L option.

Beyond that, all I can do is refer you to FAQ #10, How does ExifTool handle coded character sets? and FAQ #18, problems with special characters on the Windows command line.

QuoteQ1: how can I export just the Comment field of many photos into a single file? (I spare you the examples of what I tried already)

Always include what you've tried, as it will help clarify exactly what you are trying to do and what went wrong. As in this case, I feel I'm misunderstanding it unless you actually mean copying the Comment from files one.jpg, two.jpg, and three.jpg into the XPComment of four.jpg.

QuoteQ2: once I have edited the output file (assuming it will be UTF8 - by then) how could I copy that information into the photos and how do I specify the character set (UTF8 wanted)?

Further confused.

Edit: After reading Phil's comment, I feel that you're missing the forest for the trees. Concentrating on extracting the data to a text file rather than just copying it directly. You could copy the Comment tag to the XPComment tag in batch with this command
exiftool "-XPComment<Comment" /path/to/files/

Add the -r (-recurse) option and it will recurse into subdirectories.

QuoteQ3: I hope length of comment is no issue. Some comments are 400 chars.

There shouldn't be unless you are approaching the 64k block size limit of a JPEG. Windows might have problems with that.

One note about the XPComment tag. It is a Windows specific tag and there is almost no other software that will support it. If you ever start using a program such as Lightroom or DigiKam, or any other modern software, you'll have to go through copying it again to another tag.
* 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).

hubertd

Thank you for this long and exhaustive response.

QuoteI feel that you're missing the forest for the trees.

Oh, very much so.

Thanks to your hint, I have tried

exiftool "-XPComment<Comment" /path/to/files/
This gets me about 50% along the way. As soon as there are extended chars in the comment, exiftool wont copy the comments. Seems roughly half the files have comments with extended chars.

But I have an extract file now following Phil Harvey hint. Guess for the rest of the files it will be another nights typing.

PS: Lightroom (I have 5.7.1) does not seem to be of any help here at all. The error message I get: comments are not supported



hubertd

Thank you very much. This got me going to get the comments out. And with the hint of StarGeek I could copy comments from the Comment field into XP Comment field for about half the files. The rest needs manual tweeking (I see in the output where there are extended chars)

Quote from: Phil Harvey on April 27, 2024, 04:47:10 PMThen to copy the edited comments back again into the same files:
exiftool -csv=out.csv DIR

Any chance I could [re]import the comments into the XP Comment field (after editing) the output / then input file?

Phil Harvey

Quote from: hubertd on April 27, 2024, 08:48:21 PMAny chance I could [re]import the comments into the XP Comment field (after editing) the output / then input file?

Just change the column heading in the .csv file from "Comment" to "XPComment" before running the -csv=out.csv command.

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

hubertd

Cool. I am sorted.
Thank you very much


Greetinx
Hubert