How to Read EXIF data with ImageMagick plugin

The EXIF data is a set of information about an image. Here is a more formal definition cribbed from wikipedia:

Exchangeable image file format (officially Exif, according to JEIDA/JEITA/CIPA specifications) is a standard that specifies the formats for images, sound, and ancillary tags used by digital cameras (including smartphones), scanners and other systems handling image and sound files recorded by digital cameras. The specification uses the following existing file formats with the addition of specific metadata tags: JPEG discrete cosine transform (DCT) for compressed image files, TIFF Rev. 6.0 (RGB or YCbCr) for uncompressed image files, and RIFF WAV for audio files (Linear PCM or ITU-T G.711 μ-Law PCM for uncompressed audio data, and IMA-ADPCM for compressed audio data). It is not used in JPEG 2000 or GIF.

Cool…

In practice, the EXIF data associated with an image contains values like size of the image, aperture value, exposure time, focal length or F-number.

You can read some of the EXIF data with GeeXLab using two functions of the ImageMagick plugin exposed via the gh_imagemagick library:

– file_exif_get_num_properties()
– file_exif_get_property()

These functions are really easy to use. First, get the number of EXIF fields (or properties) available with file_exif_get_num_properties and then loop through the fields using file_exif_get_property.

As you can see, enumerating the EXIF data only requires the filename. No need to load the image and create a texture. Combined to LuaFileSystem (you can use LuaFileSystem in GeeXLab with the built-in lfs library: lfs.dir()…), you can browse your photos folders and store EXIF data in a SQLite3 database…

The DEMO

The demo is shipped with GeeXLab in the {GeeXLab folder}/apps/magickview/.

A stupid bug in GeeXLab 0.25.0.0 prevents from using the file_exif_get_property() function. So you need GeeXLab 0.25.1.0 to play with the EXIF demo.