minoki / luaexif

Lua binding for libexif
Other
11 stars 2 forks source link

luaexif

This is a Lua binding for libexif. Compatible with Lua 5.1 or later.

Install

$ luarocks make LIBEXIF_DIR=/usr/local

Or, manually with Makefile:

$ make LUA=/usr/local LIBEXIF=/usr LDFLAGS=-shared
$ cp exif.so /path/to/module/dir/

Manual

The exif module:

Data types:

Example

local exif = require "exif"
local data = exif.loadfile("mypicture.jpg") -- Load the EXIF data from "mypicture.jpg"
print(data:ifd("0"):entry("DateTime")) --> "2014:10:25 12:55:22"
local ExposureTime = data:ifd("EXIF"):entry("ExposureTime")
print(ExposureTime) --> "1/125 sec."
print(ExposureTime.format) --> "Rational"
print(ExposureTime.data) --> "1/125"
print(ExposureTime.data.value) --> "0.008"

Note that requiring "exif" module doesn't set a global variable with the module name. You can assign the module (result of require) to a local variable, as in the example above.

Links