[Digikam-devel] [Bug 114211] image comments encoding unreadable after moving an album

Gilles Caulier caulier.gilles at free.fr
Tue Apr 25 13:39:22 BST 2006


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=114211         




------- Additional Comments From caulier.gilles free fr  2006-04-25 14:39 -------
Marcel,

To clarify how Comments are embedded into JPEG files, i will describe this feature. There is 3 ways to embedded a comment in JPEG :

1/ the first is the JFIF COM section. 

Important : this section is outside EXIF/IPTC/XMP section. Unlike konqueror file properties said, the comments don't come from Exif but JFIF in this dialog !!! (Perhaps this problem have been fixed in KDE 3.5.x).

There is no size limitation know but i don't know if UTF8 is supported here. This way have always been used by digikam since 0.7.x release to store comments in JPEG file.

2/ The second is the Exif UserComments tag. Like Exiv2 documentation said, this field support UTF8. In trunk, the DMetadata class implementation need to be fixed following this example.

//-------------------------------------------------------------
00029 Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(argv[1]);
00030     assert (image.get() != 0);
00031     image->readMetadata();
00032     Exiv2::ExifData &exifData = image->exifData();
00033 
00034     /*
00035      Exiv2 uses a CommentValue for Exif user comments. The format of the
00036      comment string includes an optional charset specification at the beginning:
00037 
00038      [charset=["]Ascii|Jis|Unicode|Undefined["] ]comment
00039 
00040      Undefined is used as a default if the comment doesn't start with a charset
00041      definition.
00042 
00043      Following are a few examples of valid comments. The last one is written to
00044      the file.
00045     */
00046     exifData["Exif.Photo.UserComment"]
00047         = "charset=\"Unicode\" An Unicode Exif comment added with Exiv2";
00048     exifData["Exif.Photo.UserComment"]
00049         = "charset=\"Undefined\" An undefined Exif comment added with Exiv2";
00050     exifData["Exif.Photo.UserComment"]
00051         = "Another undefined Exif comment added with Exiv2";
00052     exifData["Exif.Photo.UserComment"]
00053         = "charset=Ascii An ASCII Exif comment added with Exiv2";
00054 
00055     std::cout << "Writing user comment '"
00056               << exifData["Exif.Photo.UserComment"]
00057               << "' back to the image\n";
00058 
00059     image->writeMetadata();
//-------------------------------------------------------------

3/ The last is IPTC caption tag : do not support UTF8 (only ascii latin1) and limited to 2000 charactors.

In fact, to solve definitivly UTF8 problem with metadata in the future, we need to support XMP metadata. Exiv2 will support XMP in the future:

http://dev.robotbattle.com/bugs/view_all_bug_page.php (select Exiv2 project to the top-right of the page)

We need to be patient (:=)))...

Some URL :

http://park2.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
http://www.iptc.org/IIM/4.1/specification/IIMV4.1.pdf
http://www.adobe.com/products/xmp/main.html

Gilles Caulier



More information about the Digikam-devel mailing list