Пример #1
0
QString DMetadata::getExifTagStringFromTagsList(const QStringList& tagsList) const
{
    QString val;

    foreach(const QString& tag, tagsList)
    {
        val = getExifTagString(tag.toLatin1().constData());

        if (!val.isEmpty())
            return val;
    }
Пример #2
0
bool DMetadata::mSecTimeStamp(const char* const exifTagName, int& ms) const
{
    bool ok     = false;
    QString val = getExifTagString(exifTagName);

    if (!val.isEmpty())
    {
        int sub = val.toUInt(&ok);

        if (ok)
        {
            int _ms = (int)(QString::fromLatin1("0.%1").arg(sub).toFloat(&ok) * 1000.0);

            if (ok)
            {
                ms = _ms;
                qCDebug(DIGIKAM_METAENGINE_LOG) << "msec timestamp: " << ms;
            }
        }
    }

    return ok;
}
Пример #3
0
KExiv2::ImageColorWorkSpace KExiv2::getImageColorWorkSpace() const
{
    // Check Exif values.

    long exifColorSpace = -1;
    if (!getExifTagLong("Exif.Photo.ColorSpace", exifColorSpace))
    {
#ifdef _XMP_SUPPORT_
        QVariant var = getXmpTagVariant("Xmp.exif.ColorSpace");
        if (!var.isNull())
            exifColorSpace = var.toInt();
#endif // _XMP_SUPPORT_
    }

    if (exifColorSpace == 1)
    {
        return WORKSPACE_SRGB; // as specified by standard
    }
    else if (exifColorSpace == 2)
    {
        return WORKSPACE_ADOBERGB; // not in the standard!
    }
    else
    {
        if (exifColorSpace == 65535)
        {
            // A lot of cameras set the Exif.Iop.InteroperabilityIndex,
            // as documented for ExifTool
            QString interopIndex = getExifTagString("Exif.Iop.InteroperabilityIndex");
            if (!interopIndex.isNull())
            {
                if (interopIndex == "R03")
                    return WORKSPACE_ADOBERGB;
                else if (interopIndex == "R98")
                    return WORKSPACE_SRGB;
            }
        }

        // Note: Text EXIF ColorSpace tag may just not be present (NEF files)

        // Nikon camera set Exif.Photo.ColorSpace to uncalibrated or just skip this field,
        // then add additional information into the makernotes.
        // Exif.Nikon3.ColorSpace: 1 => sRGB, 2 => AdobeRGB
        long nikonColorSpace;
        if (getExifTagLong("Exif.Nikon3.ColorSpace", nikonColorSpace))
        {
            if (nikonColorSpace == 1)
                return WORKSPACE_SRGB;
            else if (nikonColorSpace == 2)
                return WORKSPACE_ADOBERGB;
        }
        // Exif.Nikon3.ColorMode is set to "MODE2" for AdobeRGB, but there are sometimes two ColorMode fields
        // in a NEF, with the first one "COLOR" and the second one "MODE2"; but in this case, ColorSpace (above) was set.
        if (getExifTagString("Exif.Nikon3.ColorMode").contains("MODE2"))
            return WORKSPACE_ADOBERGB;

        //TODO: This makernote tag (0x00b4) must be added to libexiv2
        /*
        long canonColorSpace;
        if (getExifTagLong("Exif.Canon.ColorSpace", canonColorSpace))
        {
            if (canonColorSpace == 1)
                return WORKSPACE_SRGB;
            else if (canonColorSpace == 2)
                return WORKSPACE_ADOBERGB;
        }
        */

        // TODO : add more Makernote parsing here ...

        if (exifColorSpace == 65535)
            return WORKSPACE_UNCALIBRATED;
    }

    return WORKSPACE_UNSPECIFIED;
}