Png Library?

I’m looking for a post here ( forums/code exchange… I’m not sure… ) about a Png Library which extracts data about the PNG image (like height,width,etc) from the PNG file.

I can’t seem to find the library anywhere.
Anyone know which library that is? [import]uid: 64174 topic_id: 28770 reply_id: 328770[/import]

Never mind. Got it
PngLib [import]uid: 64174 topic_id: 28770 reply_id: 115937[/import]

For pure Lua, I found: http://lua-users.org/wiki/PortableNetworkGraphicsParser
For C++, there is a great little file called picoPNG: http://lodev.org/lodepng/picopng.cpp

If all you need is the Width/Height, It’s 2 integers, ranging from bytes 16, 17, 18, 19 for width, and 20, 21, 22, 23 for height at the beginning of the file. Bit depth(32Bit, 16Bit, Palletized, etc…) is also contained in the header, but off the top of my head, I can’t recall if it’s before or after the width/height. [import]uid: 134101 topic_id: 28770 reply_id: 115946[/import]

I did use some PNG extraction in a recent post, though it just used io.open() and file:read(), not any library:

Snippet with PNG code

I needed to know the dimensions to compensate for some display.save() quirks, but opening the file normally to check them was caching it as an image, which interfered with loading the file as a mask.

I just Google’d around to find the header structure. [import]uid: 27791 topic_id: 28770 reply_id: 115953[/import]