Expand description
Pure image → ASCII-art kernel. Decodes nothing and touches no terminal;
callers pass an already-decoded RgbaImage. Mirrors render’s discipline:
plain inputs, plain cell outputs, exhaustively unit-tested.
Structs§
- Animation
- Decoded animation: per-frame RGBA + the delay until the next frame, plus the
loop count (
None= infinite).
Enums§
- Animation
Decode - Outcome of
decode_animation. - Ascii
Style - Rendering aesthetic.
Constants§
- BLOCK_
SHADES - Block-shade ramp for
--blocksunder--no-color(no SGR available). - CELL_
ASPECT - Terminal cells are about twice as tall as wide.
- RAMP
- Luminance ramp, darkest → brightest. Index by
lum * (len-1) / 255.
Functions§
- decode_
animation - Decode an animated image. Returns
Staticfor a single-frame / non-animated source (caller falls back todecode_image),Animatedfor a playable multi-frame animation, orUnsupportedwhen the source is animated but its frames can’t be decoded (so the caller can show the first frame and hint). GIF loop count comes from the NETSCAPE extension; other formats default to infinite. GIF, 8-bit APNG, and animated WebP decode toAnimated; a 16-bit APNG (which theimagecrate rejects) decodes toUnsupported— both covered bytests/animation_decode.rs. - decode_
image - Decode the full image bytes to RGBA8. For animated GIFs this yields the first frame. Returns the decoder error string on failure.
- output_
rows - How many cell rows
render_imageproduces for an image of the given pixel dimensions atcolscolumns. Pure; used for scroll math. - parse_
gif_ loop_ count - Extract the loop count from a GIF’s NETSCAPE2.0 application extension.
Returns
Some(0)for infinite,Some(n)for a finite count, orNonewhen the extension is absent (callers treat that as infinite). Theimagecrate’s high-level decoder does not expose this, so we read it directly. - render_
image - Render the image to a grid of styled cells
colswide.colorcontrols whether per-cell foreground color is set (false ≈--no-color). - sniff_
image_ format - Identify an image by its leading bytes. Returns a short format name (for the
status line) or
Noneif the bytes are not a supported image. Content-based only — never guesses from a file extension — so text never misfires.