local nanojpeg = require'nanojpeg'
A ffi binding of NanoJPEG, a very small JPEG decoder suitable for embedded applications.
nanojpeg.load(path | t) -> image
Read and decode a JPEG image.
t
is a table specifying:
path
: read data from a file given its filenamestring
: read data from a stringcdata
, size
: read data from a bufferThe returned image object is a table with the fields:
data
, size
, format
, stride
, w
, h
: image format, data and dimensions.
rgb8
or g8
, that is 24bit RGB or 8bit gray; use bitmap to convert to other formats.See also: libjpeg