writing a caption to a jpeg file so that digikam will recognize it

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

writing a caption to a jpeg file so that digikam will recognize it

Jim Gomi
How do I write a caption into a JPEG file's metadata in such a way that
digikam will see it and recognize it as a Caption?

I would like to do this using some scriptable method such as a python
module or a command-line utility like exiftool or exiv2.


Reply | Threaded
Open this post in threaded view
|

Re: writing a caption to a jpeg file so that digikam will recognize it

Simon Cropper-4
On 27/12/16 08:35, Jim Gomi wrote:
How do I write a caption into a JPEG file's metadata in such a way that
digikam will see it and recognize it as a Caption?

I would like to do this using some scriptable method such as a python
module or a command-line utility like exiftool or exiv2.



Hey Jim,

Back engineer the tag data.

Create a caption in digikam, save the data to the JPG file (normal behaviour for digikam; see settings if this does not already happen) then use exiftool (windows) or exiv2 (linux) to extract the metadata and see what tag it was stored.

--
Cheers Simon
Reply | Threaded
Open this post in threaded view
|

Re: writing a caption to a jpeg file so that digikam will recognize it

Jim Gomi
On Tue, 2016-12-27 at 12:59 +1100, Simon Cropper wrote:

> On 27/12/16 08:35, Jim Gomi wrote:
> > How do I write a caption into a JPEG file's metadata in such a way
> > that
> > digikam will see it and recognize it as a Caption?
> >
> > I would like to do this using some scriptable method such as a
> > python
> > module or a command-line utility like exiftool or exiv2.
> >
> >
>  
> Hey Jim,
>
> Back engineer the tag data.
>
> Create a caption in digikam, save the data to the JPG file (normal
> behaviour for digikam; see settings if this does not already happen)
> then use exiftool (windows) or exiv2 (linux) to extract the metadata
> and see what tag it was stored.
>
> -- 
> Cheers Simon


I tried that. E.g., if I extract the metadata using
exiv2 ex IMG_0910.JPG
then I get a bunch of complicated stuff including:

<rdf:li xml:lang="x-default">This is a picture of a person</rdf:li> 
<exif:UserComment> <rdf:Alt> <rdf:li xml:lang="x-default">This is a
picture of a person</rdf:li> </rdf:Alt> </exif:UserComment>
<dc:description> <rdf:Alt> <rdf:li xml:lang="x-default">This is a
picture of a person</rdf:li> </rdf:Alt> </dc:description>

So it seems that the caption has been placed in multiple tags, and I
don't know how to write to those tags.




Reply | Threaded
Open this post in threaded view
|

Re: writing a caption to a jpeg file so that digikam will recognize it

Erick Moreno
Usually DK uses multiple places to save the same information to improve compatibility with other softwares (lightroom, acdsee...).

You can do the same, but I think you can start with dc:description.

According to the documentation: http://www.exiv2.org/sample.html  this must work:

set Xmp.dc.description This is a picture of a person

[]'s

On Tue, Dec 27, 2016 at 4:52 PM, Jim Gomi <[hidden email]> wrote:
On Tue, 2016-12-27 at 12:59 +1100, Simon Cropper wrote:
> On 27/12/16 08:35, Jim Gomi wrote:
> > How do I write a caption into a JPEG file's metadata in such a way
> > that
> > digikam will see it and recognize it as a Caption?
> >
> > I would like to do this using some scriptable method such as a
> > python
> > module or a command-line utility like exiftool or exiv2.
> >
> >
>  
> Hey Jim,
>
> Back engineer the tag data.
>
> Create a caption in digikam, save the data to the JPG file (normal
> behaviour for digikam; see settings if this does not already happen)
> then use exiftool (windows) or exiv2 (linux) to extract the metadata
> and see what tag it was stored.
>
> -- 
> Cheers Simon


I tried that. E.g., if I extract the metadata using
exiv2 ex IMG_0910.JPG
then I get a bunch of complicated stuff including:

<rdf:li xml:lang="x-default">This is a picture of a person</rdf:li> 
<exif:UserComment> <rdf:Alt> <rdf:li xml:lang="x-default">This is a
picture of a person</rdf:li> </rdf:Alt> </exif:UserComment>
<dc:description> <rdf:Alt> <rdf:li xml:lang="x-default">This is a
picture of a person</rdf:li> </rdf:Alt> </dc:description>

So it seems that the caption has been placed in multiple tags, and I
don't know how to write to those tags.







--
Reply | Threaded
Open this post in threaded view
|

Re: writing a caption to a jpeg file so that digikam will recognize it

Gilles Caulier-4
The lead XMP namespace is "digiKam". We store all metadata that we cannot store in usual XMP namespaces. Start by this one.


Gilles Caulier

2016-12-27 20:14 GMT+01:00 Erick Moreno <[hidden email]>:
Usually DK uses multiple places to save the same information to improve compatibility with other softwares (lightroom, acdsee...).

You can do the same, but I think you can start with dc:description.

According to the documentation: http://www.exiv2.org/sample.html  this must work:

set Xmp.dc.description This is a picture of a person

[]'s

On Tue, Dec 27, 2016 at 4:52 PM, Jim Gomi <[hidden email]> wrote:
On Tue, 2016-12-27 at 12:59 +1100, Simon Cropper wrote:
> On 27/12/16 08:35, Jim Gomi wrote:
> > How do I write a caption into a JPEG file's metadata in such a way
> > that
> > digikam will see it and recognize it as a Caption?
> >
> > I would like to do this using some scriptable method such as a
> > python
> > module or a command-line utility like exiftool or exiv2.
> >
> >
>  
> Hey Jim,
>
> Back engineer the tag data.
>
> Create a caption in digikam, save the data to the JPG file (normal
> behaviour for digikam; see settings if this does not already happen)
> then use exiftool (windows) or exiv2 (linux) to extract the metadata
> and see what tag it was stored.
>
> -- 
> Cheers Simon


I tried that. E.g., if I extract the metadata using
exiv2 ex IMG_0910.JPG
then I get a bunch of complicated stuff including:

<rdf:li xml:lang="x-default">This is a picture of a person</rdf:li> 
<exif:UserComment> <rdf:Alt> <rdf:li xml:lang="x-default">This is a
picture of a person</rdf:li> </rdf:Alt> </exif:UserComment>
<dc:description> <rdf:Alt> <rdf:li xml:lang="x-default">This is a
picture of a person</rdf:li> </rdf:Alt> </dc:description>

So it seems that the caption has been placed in multiple tags, and I
don't know how to write to those tags.







--

Reply | Threaded
Open this post in threaded view
|

Re: writing a caption to a jpeg file so that digikam will recognize it

Jim Gomi
On Tue, 2016-12-27 at 21:00 +0100, Gilles Caulier wrote:
> The lead XMP namespace is "digiKam". We store all metadata that we
> cannot store in usual XMP namespaces. Start by this one.
>
> http://www.exiv2.org/tags-xmp-digiKam.html

Thank you, but I don't see any information there about which metadata
tags digikam uses to store the text of the Caption itself.

However, I've done some investigation of how digikam behaves in the
wild.

If I use exiv2 to read all the metadata tags, I get 6 that store the
caption:
exiv2 -pa IMG_0910.JPG
...
Exif.Image.ImageDescription  Ascii      22  This is a picture of a person
Exif.Photo.UserComment       Undefined  29  This is a picture of a person
Iptc.Application2.Caption    String     21  This is a picture of a person
Xmp.tiff.ImageDescription    LangAlt     1  lang="x-default" This is a picture of a person
Xmp.exif.UserComment         LangAlt     1  lang="x-default" This is a picture of a person
Xmp.dc.description           LangAlt     1  lang="x-default" This is a picture of a person
...

In order to get digikam to see a different caption, e.g. "Happy
People", I need to overwrite TWO of those tags:

exiv2 -M'set Xmp.exif.UserComment lang="x-default" Happy People' IMG_0910.JPG
exiv2 -M'set Xmp.dc.description lang="x-default" Happy People' IMG_0910.JPG

As long as I rewrite BOTH those tags, digikam sees the new caption.
The other tags with the old caption are still there (originally written
by digikam itself!) but are ignored:

exiv2 -pa IMG_0910.JPG
...
Exif.Image.ImageDescription   Ascii      22  This is a picture of a person
Exif.Photo.UserComment        Undefined  29  This is a picture of a person
Iptc.Application2.Caption     String     21  This is a picture of a person
Xmp.tiff.ImageDescription     LangAlt     1  lang="x-default" This is a picture of a person
Xmp.exif.UserComment          LangAlt     1  lang="x-default" Happy People
Xmp.dc.description            LangAlt     1  lang="x-default" Happy People
...