Thread

Posted on Thu Dec 14 18:55:05 2006 by airmoi
How to had carriage return in IPTC:Caption-abstract?
Hi, I'm trying to put carriage return in IPTC:Caption-abstract but I can't do it. I tried adding \n or chr(013)in my string, also tried "AddValue" option but i still get a square instead of carriage return! What am I doing wrong?
Direct Responses: 3781 | Write a response
Posted on Thu Dec 14 19:10:13 2006 by exiftool in response to 3779
Re: How to had carriage return in IPTC:Caption-abstract?
Via the API, you do it by adding a "\n" in the value string in your call to SetNewValue(). But it seems you have tried this already. Be sure that you are using double quotes. What makes you think this doesn't work?

I suspect it is working, but that either you aren't extracting control characters or your the control character is wrong for your display device. (I don't know how you are looking at the output -- in a terminal? a text editor?)

- Phil
Direct Responses: 3785 | Write a response
Posted on Thu Dec 14 19:53:59 2006 by airmoi in response to 3781
Re: How to had carriage return in IPTC:Caption-abstract?
Looking it with PixVue or other image editors like ACDSEE or photoshop Field should looks like this: Line 1 : some text Line 2 : Some text etc.. I tried different ways like :
SetNewValue('IPTC:Caption-abstract' => $text1."\n".$text2."\n".$text3);
or
$caption = "$text1 \n $text2 \n $text3"; SetNewValue('IPTC:Caption-abstract' => $caption);
or
$cr = chr(013); $caption = "$text1 $cr $text2 $cr $text3"; SetNewValue('IPTC:Caption-abstract' => $caption);
All don't works
Direct Responses: 3786 | Write a response
Posted on Thu Dec 14 21:17:36 2006 by exiftool in response to 3785
Re: How to had carriage return in IPTC:Caption-abstract?
The first two techniques will work. The problem is likely that your display software expects different linefeeds. I would guess it wants "\n\r" if it is PC software. Your 3rd example won't work, because "013" is the octal representation of 11.

- Phil
Direct Responses: 3791 | Write a response
Posted on Thu Dec 14 23:55:17 2006 by cjsmall in response to 3786
Re: How to had carriage return in IPTC:Caption-abstract?
Regarding this issue, on my Solaris system I try: exiftool -UserComment="aaa\nbbb\nccc" file.jpg and then try: exiftool -UserComment file.jpg User Comment : aaa\nbbb\nccc so I am also seeing the same problem where the "\n" is simply being treated as two characters rather than as a newline. If a newline was actually being output, I would expect to see something line: exiftool -UserComment file.jpg User Comment : aaa bbb ccc Regards, -- Jeffery Small
Direct Responses: 3795 | Write a response
Posted on Fri Dec 15 00:53:34 2006 by exiftool in response to 3791
Re: How to had carriage return in IPTC:Caption-abstract?
Hi Jeffery,

The command line interface is different than the API because "\n" is interpreted as a newline in Perl, but not at the command line.

From the command line, you have two options. The easiest is to put the comment in a file and use "-usercomment<=FILE". The other way is a bit trickier, but this should work in most Unix shells:

exiftool -usercomment="aaa\ bbb\ ccc"

(where you actually press RETURN after the "\" character.)

- Phil
Direct Responses: 3899 | Write a response
Posted on Wed Dec 27 00:23:19 2006 by jlbec in response to 3795
Re: How to had carriage return in IPTC:Caption-abstract?
Phil,

How can one do this in "-@ argfile" format? If I want to use the following:

exiftool -iptc:caption-abstract="aaa\ bbb" img.jpg


it only works from the command line. If I put:

-iptc:caption-abstract="aaa\ bbb"


in /tmp/argfile, and run:

exiftool -@ /tmp/argfile img.jpg


it gives an error. The second line is unrecognized.

What about "-iptc:caption-abstract=<FILE"? Well, that doesn't support adding lines. I can't do "-iptc:caption-abstract+=<FILE". Whereas with "-@ argfile" I can do +=. I'm really wary of having to extract the data, then munge it myself, then reinsert it. And generating shell escapes is always nutty.

- Joel
Direct Responses: 3902 | Write a response
Posted on Wed Dec 27 00:49:59 2006 by exiftool in response to 3899
Re: How to had carriage return in IPTC:Caption-abstract?
Hi Joel,

(I crossed your post about CreatorJobTitle, but you were correct there.)

The -@ option can't be used for arguments with carriage returns in them, since the carriage returns are used for argument separators.

These can be added with the "<=" syntax (note: not "=<"!). The following should work:

exiftool "-iptc:keywords+<=FILE" test.jpg

But the you can't add tags to the Caption-Abstract, because this is not a list-type tag. The "+=" is only meaningful for list or date/time tags.

- Phil
Direct Responses: 3903 | Write a response
Posted on Wed Dec 27 00:57:50 2006 by jlbec in response to 3902
Re: How to had carriage return in IPTC:Caption-abstract?
Phil,

Ok, so "+<=" will work for list items? Excellent! You make a valid point about Caption-Abstract being a string, not a list. I was referencing another tool's ability to append to captions, but clearly they do Read-Modify-Write, as must I.

- Joel
Direct Responses: 3906 | Write a response
Posted on Wed Dec 27 14:40:12 2006 by exiftool in response to 3903
Re: How to had carriage return in IPTC:Caption-abstract?
Hi Joel,

If you want to add text to a caption, it can be done using exiftool like this:

exiftool '-caption-abstract<${caption-abstract} new text here' test.jpg

But here again you are stuck with command-line limitations if you want the text to contain newlines.

- Phil
Write a response