Skip to content

Introduction

Picguin is a collection of fast, pure Luau image codecs for a growing range of formats.
It provides a standardized interface for straightforward decoding & encoding.

  • Fully type-safe, optimized using modern techniques for maximum performance
  • Lightweight, self-contained implementations with zero dependencies
  • Seamlessly compatible with Roblox, Lune, and other Luau runtimes
  • Architected to easily scale and support new formats over time

Installation

Picguin codecs can be individually installed using the following methods:

Each codec is published under the picguin/ scope in the pesde index.

Install pesde, and run the following commands in your project:

bash
pesde add picguin/codec
pesde install

(replace codec with your desired format, e.g. png)

The codec will be installed under the target environment defined in your pesde.toml.

Example Usage

Below is a typical workflow using the PNG codec to decode a static image:

luau
local png = require("@packages/png")
local image = require("some/image/module")

local source: buffer -- png binary data

local parsed, err = png.decode(source, {
	crc = "none" -- (png-specific) disable crc checks, improving parsing speed
})
if parsed == nil then
	error(`parse error ({err.code}): {err.message}`)
end

local width, height = parsed.width, parsed.height

local cel, err = parsed.cel(0, "rgba8") -- frame 0 -> rgba8 bitmap (default)
if cel == nil then
	error(`cel error ({err.code}): {err.message}`)
end

image:write(cel.bitmap, cel.region.size, cel.region.position)

WARNING

Picguin is in early development, and the public API across codecs is subject to change.
All packages will remain pre-v1.0.0 until a stable design is in place.

Released under the MIT License.