lights FAQ Forum github.com/luapower/nanojpeg
nanojpeg

Unsupported
syscall
bnet
lfs
lanes
mmap WIP
stdio WIP
vararg
nanojpeg
openvg WIP
hpdf
svg_parser WIP
ffi_reflect
struct
pmurhash
murmurhash3
md4
crc32
ringbuffer
dlist
obj_parser
glut
fbclient WIP
portaudio
libssh2 WIP
minizip
terra
llvm
utf8 WIP
ucdn
chipmunk
libvlc WIP
libvorbis WIP

nanojpeg

JPEG reader


local nanojpeg = require'nanojpeg'

A ffi binding of NanoJPEG, a very small JPEG decoder suitable for embedded applications.

Limitations

  • 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

API

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
      • cdata, size: read data from a buffer

The returned image object is a table with the fields:

  • data, size, format, stride, w, h: image format, data and dimensions.
    • depending on the input file, the format can be either rgb8 or g8, that is 24bit RGB or 8bit gray; use bitmap to convert to other formats.

See also: libjpeg


Last updated: 2 years ago | Edit on GitHub

Pkg type:Lua+ffi
Version: r2-27-g178a9e9
Last commit:
License: PD
Import ver: 1.3
Requires: +glue  +luajit  +stdio  +glue  +luajit  +stdio 
Required by: none

Top