Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

libpicinfo: A library to read image information

0.0.2

libpicinfo is a C++ library for reading auxiliary information from images. it currently supports TIFF, JPEG and Canon RAW files (CR2). Current feautures includes:

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.

Platform Supported

This project is being develop under Linux 2.6, and tested on Linux 2.6 and Windows XP Professional. The code depends only on the standard C++ library, so it should be ported easily to other platforms. The only catch is it needs a recent C++ compiler to compile the templates properly. I use gcc 3.4.4 on Linux and MSVC 7.1 on Windows, and both worked fine.

Installation

Under *nix(-like) environments, the standard autotools method works:

    ./configure
    make
    make install

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.

Contribute

If you want to contribute to the project, please send email to me on the following areas:

I will try to setup a mailing list for discussions of the development.

License

The libpicinfo library is release under GNU Lesser General Public License (LGPL). That means it is Free Software, but can be used by (linked to) in proprietary software, though all modification of the library MUST be released under LGPL, and the library MUST be linked dynamically.

Author(s)

Nestal W.H. Wan

Links


Generated on Fri Jan 13 23:38:11 2006 for picinfo by  doxygen 1.4.4