Decoding PNG binary to table

I want to create a plugin for image analysis.
I have to convert the binary PNG to Table for that, but I don’t know how to do it.

The class I’m using:

PromptImportFile
File

You could use :GetBinaryContents() and sort through the binary string?
(i couldnt find the wiki page for that method because it returned a 404 error)

I think it is possible

Even if you get the binary contents, decoding it is quite the undertaking. You can find the format specs here if you want to try it, though:

http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html

There are existing implementations in Lua, such as this one, but they don’t cover all scenarios (e.g. that one doesn’t support ancillary chunks) and might not work out depending on your usecase.

3 Likes