Example #1
0
bool NegativeProcessor::getRawExifTag(const char* exifTagName, dng_date_time_info* value) {
    Exiv2::ExifData::const_iterator it = m_RawExif.findKey(Exiv2::ExifKey(exifTagName));
    if (it == m_RawExif.end()) return false;

    dng_date_time dt; dt.Parse((it->print(&m_RawExif)).c_str()); value->SetDateTime(dt);
    return true;
}
Example #2
0
bool NegativeProcessor::getRawExifTag(const char* exifTagName, dng_string* value) {
    Exiv2::ExifData::const_iterator it = m_RawExif.findKey(Exiv2::ExifKey(exifTagName));
    if (it == m_RawExif.end()) return false;

    value->Set_ASCII((it->print(&m_RawExif)).c_str()); value->TrimLeadingBlanks(); value->TrimTrailingBlanks();
    return true;
}
Example #3
0
void ThumbView::updateExifInfo(QString imageFullPath)
{
	Exiv2::Image::AutoPtr exifImage;
	QString key;
	QString val;

	try	{
		exifImage = Exiv2::ImageFactory::open(imageFullPath.toStdString());
		exifImage->readMetadata();
	}
	catch (Exiv2::Error &error) {
		return;
	}

	Exiv2::ExifData &exifData = exifImage->exifData();
	if (!exifData.empty()) {
		Exiv2::ExifData::const_iterator end = exifData.end();
		infoView->addTitleEntry("Exif");
		for (Exiv2::ExifData::const_iterator md = exifData.begin(); md != end; ++md) {
			key = QString::fromUtf8(md->tagName().c_str());
			val = QString::fromUtf8(md->print().c_str());
			infoView->addEntry(key, val);
		}
	}

	Exiv2::IptcData &iptcData = exifImage->iptcData();
	if (!iptcData.empty()) {
		Exiv2::IptcData::iterator end = iptcData.end();
		infoView->addTitleEntry("IPTC");
		for (Exiv2::IptcData::iterator md = iptcData.begin(); md != end; ++md) {
			key = QString::fromUtf8(md->tagName().c_str());
			val = QString::fromUtf8(md->print().c_str());
	   		infoView->addEntry(key, val);
		}
	}

	Exiv2::XmpData &xmpData = exifImage->xmpData();
	if (!xmpData.empty()) {
		Exiv2::XmpData::iterator end = xmpData.end();
		infoView->addTitleEntry("XMP");
		for (Exiv2::XmpData::iterator md = xmpData.begin(); md != end; ++md) {
			key = QString::fromUtf8(md->tagName().c_str());
			val = QString::fromUtf8(md->print().c_str());
			infoView->addEntry(key, val);
		}
	}
}
Example #4
0
JSONNODE *ImgTagJson::genLitExif(const Exiv2::Image::AutoPtr & image)
{
    //const Exiv2::ExifData &data = image->exifData();
    Exiv2::ExifData &data = image->exifData();
    data.sortByKey();

    if (data.empty()) return NULL;

    Exiv2::ExifData::const_iterator end = data.end();

    JMAP *grpmap = new JMAP();

    JSONNODE *tree = json_new(JSON_NODE);
    json_set_name(tree, "exif");
    for (Exiv2::ExifData::const_iterator i = data.begin(); i != end; i++)
    {
        JSONNODE *grp;

        if (grpmap->find(i->groupName()) == grpmap->end())
        {
            grp = json_new(JSON_NODE);
            json_set_name(grp, i->groupName().c_str());
            grpmap->insert(JMAP::value_type(i->groupName(), grp)); 
        }
        else
           grp = (grpmap->find(i->groupName()))->second;

        Exiv2::ExifData::const_iterator nxt = i;
        nxt++;
        if ((nxt != data.end()) && (i->key() == nxt->key()))
        {
            //cout << "Array Elem! " << i->key() << endl;
            JSONNODE *arr = json_new(JSON_ARRAY);
            json_set_name(arr, i->tagName().c_str());
            json_push_back(arr, json_new_a((i->tagName()).c_str(),
                (i->print()).c_str()));

            while ((nxt != data.end()) && (nxt->key() == i->key()))
            {
                json_push_back(arr, json_new_a((nxt->tagName()).c_str(),
                    (nxt->print()).c_str()));
                nxt++;
            }
            json_push_back(grp, arr);
            if (nxt == data.end()) break;
            nxt--;
            i = nxt;
        }
        else
        {
            json_push_back(grp, json_new_a((i->tagName()).c_str(),
                (i->print()).c_str()));
        }
    }
    JMAP::iterator it;
    for(it = grpmap->begin(); it != grpmap->end(); it++)
    {
        json_push_back(tree, it->second);
        grpmap->erase(it);
    }
        //cout << it->first << endl;
    delete grpmap;
    //cout << json_write_formatted(tree) << endl;
    return tree;
}