Thread

Posted on Wed Jul 16 23:08:43 2008 by linuxuser
Linebreak in 0x010e Image Description
Is it possible to create a line break in the field 0x010e Image Description?
Direct Responses: 8333 | Write a response
Posted on Thu Jul 17 00:18:12 2008 by exiftool in response to 8332
Re: Linebreak in 0x010e Image Description
Yes.
Direct Responses: 8334 | Write a response
Posted on Thu Jul 17 00:26:37 2008 by exiftool in response to 8333
Re: Linebreak in 0x010e Image Description
Haha. I wouldn't do that to you. ;)

There are three ways:

1) In a Unix shell, you can put a line break in the command using "\" at the end of the line (not sure if you can do this in Windows though):

exiftool -imagedescription="line 1\ line 2" image.jpg

2) Create a file with the the exact description, including linebreaks, and write the value from the contents of the file:

exiftool -imagedescription"<=file.txt" image.jpg

3) Use $/ in a redirection expression to generate the newline:

exiftool "-imagedescription<line 1${/}line 2" image.jpg

The third technique, however, incurs a performance penalty since it will first read the file to extract tag values in case they are used in the expression (which they aren't).

- Phil
Direct Responses: 8335 | Write a response
Posted on Thu Jul 17 01:07:27 2008 by linuxuser in response to 8334
Re: Linebreak in 0x010e Image Description
I use linux. The description is imported from a textfile with a bash script. Every line in the textfile contains the description of 1 photo. So I need a description in 1 line like
"photo1,line1\line2"

If I create a variable
descr="photo1,line1\line2"

and use it with exiftool the description field shows the backslash with exiftool and not a linebreak.

I would consider your 2nd option, if I can't get it work with your 1st suggestion. Thanks!
Direct Responses: 8338 | Write a response
Posted on Thu Jul 17 02:59:16 2008 by exiftool in response to 8335
Re: Linebreak in 0x010e Image Description
Oh yeah. "linuxuser" is linux. Silly me. :P

I just tried a bunch of shells (sh, csh, bash, zsh), and of these the backslash at the end of a line only adds a newline in csh. But the good news is that I played around a bit in bash and it is even easier -- you can insert an actual newline in a quoted string:

#!/bin/bash descr="line1 line2" exiftool -imagedescription="$descr" image.jpg

The above bash script works for me, but of course you need to use the -b option to see the newline when you extract the value.

- Phil
Direct Responses: 8344 | Write a response
Posted on Thu Jul 17 22:38:09 2008 by linuxuser in response to 8338
Re: Linebreak in 0x010e Image Description
Phil, I tried the following and I changed the field to caption-abstract
var="line1<br>line2" var2=`echo $var | tr '<br>' '\n'` exiftool -caption-abstract="$var2" image.jpg

It creates linebreaks, but there are 3 linebreaks between line1 and line2 insteade of 1 Maybe you should know, that I would like to have this linebreak, because I like to make multilingual descriptions. Thank you!
Direct Responses: 8345 | Write a response
Posted on Thu Jul 17 22:49:38 2008 by linuxuser in response to 8344
Re: Linebreak in 0x010e Image Description
It was not a good idea to use tr, with sed it works:
var2=`echo $var | sed 's/<br>/\n\n'/g`
Write a response