I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2007-11-29 16:01:52-08 by heiko
Linefeed in Exif UserComment
Hello, I'm trying to fill my Exif UserComment with IPTC values. Therefore I'm starting ExifTool with the following command line within a .BAT file: ExifTool.exe -P -m -L "-UserComment<$IPTC:Country-PrimaryLocationName $IPTC:City $IPTC:Caption-Abstract" *.jpg The result in the UserComment is: Country City Caption How can I inclue a linefeed between the single values, so that each value is among eatch other? Any idea? Regards Heiko
Direct Responses: 6573 | Write a response
Posted on 2007-11-29 17:52:06-08 by exiftool in response to 6572
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
Posted on 2007-11-29 18:03:31-08 by exiftool in response to 6573
Re: Linefeed in Exif UserComment
One more thing. In Unix the 2-stage process can be performed on a single command line without the need for a temporary file. Something like this may also work in Windows, but again I'm no expert there. In Unix, the command would be:

exiftool a.jpg -p p.fmt | exiftool -usercomment"<=-" FILE

where "p.fmt" is the file listed in my previous post.

- Phil
Direct Responses: 6576 | Write a response
Posted on 2007-11-30 08:19:07-08 by heiko in response to 6574
Re: Linefeed in Exif UserComment
Hello Phil, thank you for your answer, and I will try your suggestions. And you are right, this should run with Windows. I hoped, that I can use a single sign for the linefeed, because my excample was only the half of the what I want to do. in the commandline are also settings like this: "-UserComment<$UserComment Heiko" -if "$Keywords=~/Heiko/" Heiko
Direct Responses: 6577 | Write a response
Posted on 2007-11-30 12:49:40-08 by exiftool in response to 6576
Re: Linefeed in Exif UserComment
OK Heiko,

I have come up with a solution. In the next release (6.04) I will add the ability to insert a newline into the expression using "$/". This version should be released in about a week or so.

- Phil
Direct Responses: 6600 | Write a response
Posted on 2007-12-03 07:22:50-08 by heiko in response to 6577
Re: Linefeed in Exif UserComment
Hi Phil, that's great. Thank you very much. Heiko
Direct Responses: Write a response