Melting the Caption of two images in a new one...

Started by Archive, May 12, 2010, 08:54:28 AM

Previous topic - Next topic

Archive

[Originally posted by pixelpicker on 2008-12-02 15:40:13-08]

Hello to all. Again: SUPER tool Phil - tested the standalone Windows Version and am VERY pleased - simple and qick.
The problem here:

In another article here I found:
Code:
exiftool '-caption-abstract<${caption-abstract} new text here' test.jpg
with that additional describtions can be added to the Caption of an image. Works perfect.

But: I want to copy the Caption of a second image additional behind a first image, separated with a pipe:

Step1:
Code:
exiftool -overwrite_original "-caption-abstract<${caption-abstract}  | " "C:\aa"
Step2:
Code:
exiftool -tagsfromfile "C:\bb\%f.jpg" "-caption-abstract<=caption-abstract" -o "C:\MELTING" "C:\aa"

The Pipe is added. Files are created, but the Caption is not added correct. I know that Caption is not a list field, but when its possible to add other words, it should also be to copy somting in from another image spource?

Thankful for any help.

Greetings from
pixelpicker

Archive

[Originally posted by exiftool on 2008-12-02 16:15:32-08]

Interesting.  The problem is that you want to copy the values
from two separate files into a single tag.  Tricky.

You have come across a limitation of the exiftool application.
Of course, this is easy to do via the API, but not via the
application.

If you are in Unix, you could do it with a command line like this:

Code:
exiftool a.jpg '-caption-abstract<$caption-abstract | '`exiftool b.jpg -caption-abstract -b`

But I don't know a way to do this in Windows.

You could also do it by going through a temporary file.  This should work
in any O/S:

Code:
exiftool a.jpg -caption-abstract -b > tmp.txt
echo " | " >> tmp.txt
exiftool b.jpg -caption-abstract -b >> tmp.txt
exiftool a.jpg "-caption-abstract<=tmp.txt"

A bit messy too, but at least it is cross-platform.  Of course, you
could automate it somewhat by using a script or batch file.

Unfortunately, both of these techniques only process one file at a
time, so batch processing must be scripted too.

Sorry I don't have a perfect solution, but I hope this helps.

- Phil

Archive

[Originally posted by pixelpicker on 2008-12-02 20:50:29-08]

Dear Phil -

thanx for your quick reply and your intelligent solutions.
"The problem is that you want to copy the values from two separate files into a single tag"

 - Yes, with the Keywords it works fine since the list tag options give the + opporunity to add something from anoter file:
Code:
-iptc:keywords+>iptc:keywords
(+ the additional code in the previous mail).

Im sorry that there is no Unix command line equivalent for Win - its very elegant. The "any O/S" solution would make me old https://exiftool.org/forum/Smileys/default/smiley.gif" alt="Smiley" border="0" /> since I have no knowledge about scripting or batch files of this type and my images are a lot (I was very happy to have found out, what you meant by "Options may also be added to the "Target" property of a Windows shortcut for the executable" in your online description of the standalone Win Version. I tried numerous times to put code in the "ExifTool_config" to create a shortcut with automatic code https://exiftool.org/forum/Smileys/default/smiley.gif" alt="Smiley" border="0" /> before I found out, how this incredible possibility works.

Hm, maybe I forgot to tell that the images are in two different folders but the equivalent images have the same names and endings (they are keyworded/captioned in different languages). Maybe there is a batch way to do it with the "any O/S" solution in a modified way? I'll try and tell here soon.

Greetings from

pixelpicker

Archive

[Originally posted by exiftool on 2008-12-02 23:25:49-08]

You didn't tell me that these were language alternatives.
For this, you really should be using XMP-dc:Description.
This is the modern counterpart of IPTC:Caption-Abstract,
and it supports multiple languages:

Code:
exiftool -overwrite_original "-xmp:description<caption-abstract" -tagsfromfile c:\bb\%f.jpg "-xmp:description-de<caption-abstract" c:\aa

Sweet and clean, and batch processing all with a single command.

Here I have assumed your language code is "de",  but of course you would
use whatever code is appropriate for your language.  Read the
https://exiftool.org/TagNames/XMP.html" target="_blank">XMP
Tag Name documentation for more details about the use of alternate
languages in XMP.

The only drawback would be if the application you use to read meta information
doesn't support XMP or alternate languages.

- Phil

Archive

[Originally posted by pixelpicker on 2008-12-03 13:28:31-08]

Yes, you are right - but unfortunately if one is working together with others that use "old standards" because these are common to everybody, I have to follow. It's a horror - everybody is cooking his own soup without using the possibilities of new standards. This is why Exiftool is very helpful.

So your last sentence brings it to the point. But still I will investigate more on XMP cause it could help my own database to be improved and ease other things. I didn't know that one can use different languages in XMP - so many thanx for this important hint!

I will give more feetback, when I tried your code.

Greetings from

pixelpicker

Archive

[Originally posted by pixelpicker on 2008-12-04 01:28:32-08]

I tried a lot - and found a solution with your help - but its very dirty:
You gave me the idea to use other "free" list XMP fields to copy the captions together and it works perfect in batch:

1) copy Caption in XMP Subject and add Pipe:

Code:
exiftool -overwrite_original "-xmp:subject<caption-abstract" "C:\Language1"

Code:
exiftool -overwrite_original -xmp:subject+=" | " "C:\Language1"

Code:
exiftool -overwrite_original "-xmp:subject<caption-abstract" "C:\Language2"

2) melt XMP Subjects of both language folders together in new folder/file:

Code:
exiftool -tagsfromfile "C:\Language2\%f.jpg" "-xmp:subject+>xmp:subject" -o "C:\MELTING" "C:\Language1"

3) copy the XMP Subject of the new file in its Caption:

Code:
exiftool -overwrite_original "-caption-abstract<xmp:subject" "C:\MELTING"

4) delete the "false" XMP Subject

A little bit like "shot trough the breast into the knee" but I need it and it works with Exiftool without other scripts. I will use the XMP description and subject for both languages now - so many thanx to you Phil!

Greetings from

pixelpicker

Archive

[Originally posted by exiftool on 2008-12-04 12:06:21-08]

Interesting.  I hadn't thought of using another list tag as a temporary
storage variable.

You can clean this up somewhat by reducing the number of commands.
It can all be done with 2 commands:

Code:
# Step 1: copy both caption-abstracts to XMP:subject
exiftool -o c:\MELTING "-subject<caption-abstract" -addtagsfromfile C:\Language2\%f.jpg "-subject<caption-abstract" C:\Language1

# Step 2: join the subject items, write them to caption-abstract, and delete the subject
exiftool -subject= -sep " | " "-caption-abstract<subject" C:\MELTING

- Phil

Archive

[Originally posted by exiftool on 2008-12-04 12:21:57-08]

Ooops.  I forgot a -overwrite_original
option in the command for step 2.

That was a good idea you had.

- Phil

Archive

[Originally posted by pixelpicker on 2008-12-04 16:28:00-08]

Ahhh, Phil, genious you! So slim and elegant! Thank you.

But I don't understand the code. After step 1 the images in the MELT folder have both captions in the subject without the pipe. After step 2 the pipe appears at the correct place in the caption and separates the the languages.

Is this magic?? https://exiftool.org/forum/Smileys/default/smiley.gif" alt="Smiley" border="0" />

How is the pipe placed at the corret place in step 2?

Greetings from

picelpicker

Archive

[Originally posted by exiftool on 2008-12-04 16:44:51-08]

The -sep option specifies a separator string.  Here
I am using " | ".  When copying a list-type tag to a non-list-type tag,
this separator is used to join the items.  Abra kadabra! https://exiftool.org/forum/Smileys/default/smiley.gif" alt="Smiley" border="0" />

- Phil