local nanojpeg = require'nanojpeg'
A ffi binding of NanoJPEG, a very small JPEG decoder suitable for embedded applications.
- no support for arithmetic coding (rarely used)
- no support for progressive jpeg (not-so-rarely used)
- slow (compared to libjpeg-turbo)
- no option to only read the headers
nanojpeg.load(path | t) -> image
Read and decode a JPEG image.
t is a table specifying:
- where to read the data from (one of the following):
path: read data from a file given its filename
string: read data from a string
size: read data from a buffer
The returned image object is a table with the fields:
h: image format, data and dimensions.
- depending on the input file, the format can be either
g8, that is 24bit RGB or 8bit gray; use bitmap to convert to other formats.
See also: libjpeg
19 months ago
Edit on GitHub