Watch
1
0
Fork
You've already forked pngLua
0
A pure lua implementation of a PNG decoder
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jesper Jensen c2bb6b210e
Merge pull request #1 from mkartashev/master
Significant performance improvement in stream implementation.
2017-12-24 13:42:45 +01:00
30log.lua Initial commit 2013-08-29 17:03:50 +02:00
30logLICENSE Initial commit 2013-08-29 17:03:50 +02:00
deflate.lua Initial commit 2013-08-29 17:03:50 +02:00
deflateLICENSE Initial commit 2013-08-29 17:03:50 +02:00
Example.png Initial commit 2013-08-29 17:03:50 +02:00
LICENSE Initial commit 2013-08-29 07:09:35 -07:00
logo.png New logo 2015-07-30 12:26:28 +02:00
numberlua.lua Initial commit 2013-08-29 17:03:50 +02:00
numberluaLICENSE Initial commit 2013-08-29 17:03:50 +02:00
png.lua Initial commit 2013-08-29 17:03:50 +02:00
README.md Added logo 2015-04-12 22:37:58 +02:00
stream.lua Significant performance improvement in stream implementation. 2017-11-28 21:56:41 +03:00
test.lua Initial commit 2013-08-29 17:03:50 +02:00

pngLua logo

A pure lua implementation of a PNG decoder

Usage

To initialize a new png image:

img = pngImage(<path to image>, newRowCallback)

The image will then be decoded. The available data from the image is as follows

img.width = 0
img.height = 0
img.depth = 0
img.colorType = 0

img:getPixel(x, y)

Decoding the image is synchronous, and will take a long time for large images.

Support

The supported colortypes are as follows:

  • Grayscale
  • Truecolor
  • Indexed
  • Greyscale/alpha
  • Truecolor/alpha

So far the module only supports 256 Colors in png-8, png-24 as well as png-32 files. and no ancillary chunks.

More than 256 colors might be supported (Bit-depths over 8) as long as they align with whole bytes. These have not been tested.

Multiple IDAT chunks of arbitrary lengths are supported, as well as all filters.

Errors

So far no error-checking has been implemented. No crc32 checks are done.