Author Topic: How to had carriage return in IPTC:Caption-abstract?  (Read 4893 times)

Archive

  • Newbie
  • *
  • Posts: 0
How to had carriage return in IPTC:Caption-abstract?
« on: May 12, 2010, 08:53:58 AM »
[Originally posted by airmoi on 2006-12-14 16:55:05-08]

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?

Archive

  • Newbie
  • *
  • Posts: 0
Re: How to had carriage return in IPTC:Caption-abstract?
« Reply #1 on: May 12, 2010, 08:53:58 AM »
[Originally posted by exiftool on 2006-12-14 17:10:13-08]

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

Archive

  • Newbie
  • *
  • Posts: 0
Re: How to had carriage return in IPTC:Caption-abstract?
« Reply #2 on: May 12, 2010, 08:53:58 AM »
[Originally posted by airmoi on 2006-12-14 17:53:59-08]

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 :
Code:
SetNewValue('IPTC:Caption-abstract' => $text1."\n".$text2."\n".$text3);
or
Code:
$caption = "$text1 \n $text2 \n $text3";
SetNewValue('IPTC:Caption-abstract' => $caption);
or
Code:
$cr = chr(013);
$caption = "$text1 $cr $text2 $cr $text3";
SetNewValue('IPTC:Caption-abstract' => $caption);

All don't works

Archive

  • Newbie
  • *
  • Posts: 0
Re: How to had carriage return in IPTC:Caption-abstract?
« Reply #3 on: May 12, 2010, 08:53:58 AM »
[Originally posted by exiftool on 2006-12-14 19:17:36-08]

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

Archive

  • Newbie
  • *
  • Posts: 0
Re: How to had carriage return in IPTC:Caption-abstract?
« Reply #4 on: May 12, 2010, 08:53:58 AM »
[Originally posted by cjsmall on 2006-12-14 21:55:17-08]

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

Archive

  • Newbie
  • *
  • Posts: 0
Re: How to had carriage return in IPTC:Caption-abstract?
« Reply #5 on: May 12, 2010, 08:53:58 AM »
[Originally posted by exiftool on 2006-12-14 22:53:34-08]

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:

Code:
exiftool -usercomment="aaa\
bbb\
ccc"

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

- Phil

Archive

  • Newbie
  • *
  • Posts: 0
Re: How to had carriage return in IPTC:Caption-abstract?
« Reply #6 on: May 12, 2010, 08:53:59 AM »
[Originally posted by jlbec on 2006-12-26 22:23:19-08]

Phil,

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

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

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

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

in /tmp/argfile, and run:

Code:
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

Archive

  • Newbie
  • *
  • Posts: 0
Re: How to had carriage return in IPTC:Caption-abstract?
« Reply #7 on: May 12, 2010, 08:53:59 AM »
[Originally posted by exiftool on 2006-12-26 22:49:59-08]

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:

Code:
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

Archive

  • Newbie
  • *
  • Posts: 0
Re: How to had carriage return in IPTC:Caption-abstract?
« Reply #8 on: May 12, 2010, 08:53:59 AM »
[Originally posted by jlbec on 2006-12-26 22:57:50-08]

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

Archive

  • Newbie
  • *
  • Posts: 0
Re: How to had carriage return in IPTC:Caption-abstract?
« Reply #9 on: May 12, 2010, 08:53:59 AM »
[Originally posted by exiftool on 2006-12-27 12:40:12-08]

Hi Joel,

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

Code:
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