Future release will support:
Reading data from image files is as easy as:
#include <ExifFile.hpp> #include <ExifEntry.hpp> #include <ExifTags.hpp> using namespace picinfo ; CExifFile image( "hello.jpg" ) ; CExifFile::iterator i = image.find( exif::f_number ) ; // check if the tag is present if ( i != image.end( ) ) std::cout << "Aperature is " << *i << std::endl ;
Or if you want to iterate all tags in the file:
#include <ExifFile.hpp> #include <ExifEntry.hpp> #include <ExifTags.hpp> using namespace picinfo ; CExifFile image( "hello.jpg" ) ; for ( CExifFile::iterator i = image.begin( ) ; i != image.end( ) ; ++i ) std::cout << "The " << i->LongName( ) << " is " << *i << std::endl ;
After retrieving an data entry in the file, you can convert it to any type it supports by calling the picinfo::CExifEntry::As() function:
#include <ExifFile.hpp> #include <ExifEntry.hpp> #include <ExifTags.hpp> using namespace picinfo ; CExifFile image( "hello.jpg" ) ; CExifFile::iterator i = image.find( exif::exposure_time ) ; // check if the tag is present if ( i != image.end( ) ) { double t = i->As<double>( ) ; std::cout << "Exposure time is " << t << std::endl ; }
The template magic behind As() allows you to interpret the values of the entry using a different type than its actual type. For example, the actual type of the exposure_time entry is rational number, but it is can converted to double like the above example does. In addition, all types can be converted to std::string. It will be formatted in a human readable way.
If the conversion is not supported, e.g. converting a string entry to an integer, an exception will be thrown or the code cannot be compiled.
See here for all tags supported by libpicinfo.
The name of library will be libpicinfo. It can be link with -lpicinfo in the gcc command line.
If you are a autotools wizard and thinks my usage of autotools sucks, you are more than welcomed to submit a patch.
Under win32 environment, there are project files under the win32
directory. You can use Visual C++ .NET 2003 (a.k.a. VC 7.1) to compile it. Visual C++ 6.0 is not supported.
I will try to setup a mailing list for discussions of the development.