Skip to main content

encode_png_rgba

Function encode_png_rgba 

Source
pub fn encode_png_rgba(
    data: &[u8],
    width: u32,
    height: u32,
) -> Result<Vec<u8>, String>
Expand description

Turn a raw framebuffer into a PNG the Computer Use agent can actually look at.

The screenshot and zoom crop paths have to hand the agent an image, and the API carries it as base64 PNG, so this encodes a flat RGBA buffer (with its dimensions) through the image crate and returns the PNG bytes for that response payload.