Skip to main content

encode_kitty

Function encode_kitty 

Source
pub fn encode_kitty(format: ImageFormat, bytes: &[u8], out: &mut String)
Expand description

Wrap bytes of a known image format into a single kitty graphics APC sequence. The sequence is appended to out, which keeps callers in control of stdout buffering — nms prints it through the normal value-formatter, and tests can capture the bytes for comparison.

For payloads above 4096 bytes the protocol recommends chunking with the m=1/m=0 continuation markers. We chunk at 4096 base64 characters (≈ 3072 raw bytes) so even multi-MB charts transmit without exceeding terminal buffer limits.