Image-ExifTool - Re: Linefeed in Exif UserComment

Posted on Thu Nov 29 19:52:06 2007 by exiftool in response to 6572 (See the whole thread of 6)
Re: Linefeed in Exif UserComment
Hi Heiko,

This is a command-line problem, and is a bit tricky.

In Unix you can insert linefeeds in a command by putting "\" at the end of a line, then continuing on the next one. But I doubt this will work in Windows. There may be a different way to do it in Windows, but I'm not a Windows expert and don't know how.

It would also be possible to write a simple Perl script to call the ExifTool functions since linefeeds are easy to insert into strings in Perl, but this can't be done with the Windows executable.

Another option would be do this in a 2-step process where you use the -p option to output the tags in the exact format you want to a second file, then use "-UserComment<=FILE" to set the UserComment from the contents of this file. The -p format file could look like this:

$IPTC:Country-PrimaryLocationName $IPTC:City $IPTC:Caption-Abstract

This isn't very convenient, but will do what you want.

Note that if you get this working you will also have trouble using exiftool to extract the values with linefeeds because by default all control characters are translated to '.' on output. The usual work-around is to use -b to extract the value, but you can't do this here because the binary value of UserComment isn't a simple string.

- Phil
Direct Responses: 6574 | Write a response