Extracting IPTC data using QMeta is pretty much the same as extracting EXIF data as in my previous post – Using QMeta to extract Exif data in your Qt applications. So, here I only give you a simple example to extract object name and keywords from a picture.
#include <QtGui>
#include "qmeta/image.h"
int main (int argc, char *argv[])
{
// Opens an image file. Currently supports only JPEG and TIFF files.
qmeta::Image image("path/to/image");
// Checks if the specified image is valid.
if (image.IsValid()) {
// Checks if IPTC data exists in this image.
if (image.iptc()) {
// Reads the object name from IPTC.
qDebug() << image.iptc()->Value(qmeta::Iptc::kObjectName);
// Reads keywords, note that I use the "Values()" function
// here because the "keywords" field is repeatable in IPTC.
qDebug() << image.iptc()->Values(qmeta::Iptc::kKeywords);
}
}
return 0;
}
As usual, you can find the full list of supported IPTC tags in its header file, just check the `enum Tag` type, and that’s all.
Filed under: C++, Ollix, Qt | Leave a Comment
Tags: C, cplusplus, information, IPTC, library, metadata, Ollix, photograph, Programming, QMeta, Qt, toolkit
About Me
Hi, I'm Olli. I'm a programmer as well as a microstock photographer. This blog is all about my life and my work. Please leave a message if you have any idea of my posts. Thanks.
Twitter Updates
- The new database update logic is done. Now it's time to rewrite the whole C library. 1 day ago
- I sold an image today through @shutterstock! My gallery is here: http://tinyurl.com/kmxffb 3 days ago
- New Website Launch | Ollix Blog http://t.co/5CweVRx via @ollixsoft 6 days ago
- RT @unbit: uWSGI 0.9.6 announce http://lists.unbit.it/pipermail/uwsgi/2010-August/000604.html 1 week ago
- I sold an image today through @shutterstock! My gallery is here: http://tinyurl.com/kmxffb 1 week ago
-
Recent Comments
-
Flickr Photos



More Photos -
Blog Stats
- 8,406 hits

No Responses Yet to “An example to extract IPTC data using QMeta”