PNGGIF
Pure-Crystal PNG / APNG / GIF reader.
Decodes an image file (or in-memory buffer) into RGBA bitmaps and
terminal-cell maps. Ported from Blessed's bundled vendor/tng.js
(https://github.com/chjj/tng, MIT). Extracted from Crysterm into a standalone
shard so it can be reused independently of the TUI toolkit.
PNG decompression uses Crystal's stdlib Compress::Zlib; GIF uses a ported
LZW decoder. JPEG and other formats are converted to PNG via ImageMagick's
convert if it is available.
Constants
The 8-byte PNG file signature.
Class methods
Encodes frames ({bitmap, delay_ms}) as an animated PNG (APNG) and returns
the file bytes. num_plays is the loop count (0 = loop forever). The first
frame doubles as the still IDAT (so non-APNG viewers show it). All frames
must share the canvas size of the first frame.
Encodes frames ({bitmap, delay_ms}) as an animated PNG (APNG) and returns
the file bytes. num_plays is the loop count (0 = loop forever). The first
frame doubles as the still IDAT (so non-APNG viewers show it). All frames
must share the canvas size of the first frame.
Encodes bmp as a still PNG, writing the file bytes to io.