[Digikam-devel] Image Metadata extraction : implementation progress...

Caulier Gilles caulier.gilles at kdemail.net
Wed Mar 1 22:06:19 GMT 2006


Le Mardi 28 Février 2006 04:51 PM, Andreas Huggel a écrit :
> Hi,
>
> Thanks for using Exiv2!
>
> On Tuesday 28 February 2006 19:39, Gilles Caulier wrote:
> > Le Mardi 28 Février 2006 11:09, Gilles Caulier a écrit :
> > > Hi all digiKam users/team,
> > >
> > > Like you have seen last week, I have started a new implementation of
> > > metadata viewer using libExiv2 instead the current Exif viewer using
> > > libkexif.
> > >
> > > A fresh screenshot can be seen here :
> > >
> > > http://digikam3rdparty.free.fr/Screenshots/digikam0.9.0-alpha6.png
>
> Nice pictures. I noticed that the metadata is shown as plain values as
> opposed to human readable strings, e.g., "ResolutionUnit 2" as opposed to
> "ResolutionUnit inch". Can the user change that with the "Level of detail"
> setting ("Simple" sounds like not everything is shown though)? Especially
> for makernotes, the more readable expressions might be more useful than
> plain values. You can get these easily by using the output operator for
> Exifdatum.

I have tried to do it like this :

        for (Exiv2::ExifData::iterator md = exifData.begin(); md != 
exifData.end(); ++md)
        {
...     
            Exiv2::Exifdatum ed = exifData[md->key().c_str()];
                       
...
        }

... but after, i need to do what exactly ?

And another question : how to get a more user friendly value of tag. The Exif 
data are sometime uninterpreted number values instead of strings. EG for a 
Nikon Camera there is a FlashpixVersion string which ist shown as 48 49 48 48 
probably meaning 1.00.   Other things like exposure time (and many more) are 
displayed as a fraction (10/200) instead of a clearer value (1/20). This kind 
of interpretation problems happen in many other EXIF tags as well.

There is a way in Exiv2 to solve it or i need to polish the Exiv2 output in 
digiKam ?

>
> > Current Exiv2 problems (correct me if i'm wrong (:=))) :
> >
> > - The tags descriptions exist in Exiv2 but I can access it easily in my
> > implementation...
>
> Assuming this should read "can _not_ access it easily" and refers to the
> commented code in eg, ExifWidget::getTagDescription(): What about smth like
> this (ignoring the conversions from and to QString):
>
>   try {
>       Exiv2::ExifKey ek(key);
>       return Exiv2::ExifTags::tagDesc(ek.tag(), ek.ifdId());
>   }
>   catch (Exiv2::AnyError& e) {
>       // not an Exif key
>   }
>
> Admittedly, this is still not really nice. And yes, it doesn't use gettext
> yet.

Ok descriptions implemented. Work fine.

>
> Thanks for encouraging contributions to Exiv2. i18n support is a
> particularly good candidate for someone who knows or would like to learn
> gettext.
>
> > Here we are a patch against current digikam from svn 'trunk' branch :
> >
> > http://digikam3rdparty.free.fr/misc.tarballs/metadata.diff
>
> In DMetaLoader::loadWithExiv2()
>
> +        Exiv2::ExifData& exifData = image->exifData();
>               ----------^
> Reference to prevent copying (and similar for Iptc).
>
> +    catch( Exiv2::AnyError &e )
>          ----------^^^ Baseclass in case future versions have more error
> classes
> +    {
> +        kdDebug() << "Cannot load metadata using Exiv2 (" << e << ")" <<
> endl;
>  If you wanted the error message instead of just a code ------^
> +        return false;
> +    }
>

Ok, i will fix it.

> Further down, there is this remark:
>
> +    // We trying to load exif data using likexif from THM file (thumbnail)
> if exist,
>      // especially provided by recent USM camera.
>
> When reading from Canon CRW files, it might be interesting to check if
> there is a correspoding THM file and use that instead. (At least some)
> Canon cameras write such files together with CRW files and they contain the
> complete Exif metadata instead of only a small subset, like the CRW file.
> Exiv2 can read Canon THM files, they are just small Jpegs.
>

This job is now implemented in digiKam camera interface. If a .thm file is 
found, i will use this file to display metadata. For example, with my Minolta 
5D, all RAW files are associed with a small .thm file.

Thanks for you help Andreas

Gilles Caulier



More information about the Digikam-devel mailing list