An example to extract IPTC data using QMeta
03Mar10
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.
Advertisement
Like this:
Be the first to like this post.
Filed under: C++, Ollix, Qt | Leave a Comment
Tags: C, cplusplus, information, IPTC, library, metadata, Ollix, photograph, Programming, QMeta, Qt, toolkit
About Me
I'm a freelancer but only working for my own projects. I'm also an amateur microstock photographer.
Twitter Updates
- had 1 commits across 1 Git repositories with 0 files created, 0 files deleted, 1 files changed, 6 insertions, and 18 deletions. 1 day ago
- had 6 commits across 1 Git repositories with 0 files created, 0 files deleted, 5 files changed, 95 insertions, and 30 deletions. 2 days ago
- had 11 commits across 3 Git repositories with 133 files created, 1 files deleted, 139 files changed, 1320 insertions, and 2589 deletions. 1 week ago
- I sold an image today through @shutterstock! My gallery is here: http://t.co/cXdZJ8d5 1 week ago
- I sold an image today through @shutterstock! My gallery is here: http://t.co/cXdZJ8d5 1 week ago
-
Recent Comments
-
Flickr Photos



More Photos -
Blog Stats
- 18,465 hits

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