literallywize/pnguin

A relatively fast PNG library for Luau

PNGuin

A relatively fast, pure Luau PNG library

Lightweight, performant, and memory-efficient Luau implementation of the PNG image format! loopThumbsUp

What this library does:

🟢  Extracting all critical PNG chunks: IHDR, PLTE and IDAT

🟢  Decoding RGBA pixel data from PNGs of any bit depth and color type

🟢  Decoding simple transparency via the tRNS chunk

🟢  Modest error checking for invalid or corrupt PNG data

What this library does...n't:

🔴  Encoding PNG data (planned)

🔴  Parsing chunks besides the ones listed above (planned)

🔴  Decoding interlaced PNGs (planned)

🔴  Decoding PNGs larger than ~1GB, this is due to Luau buffer limitations

Installation

Using Roblox

.rbxm binaries can be downloaded and imported directly from the Releases page.

Using pesde

PNGuin can be installed as a pesde package using the following commands:

pesde add literallywize/pnguin
pesde install

Usage Example:

local PNGuin = require(path.to.PNGuin)

local png -- Your PNG binary data

local pngInfo = PNGuin.Extract(png)
local pixelData, elapsed = pngInfo:DecodeRGBA()