Skip to main content

save_to_buffer

Function save_to_buffer 

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

Saves raw BGRA pixel data to a PNG buffer in memory.

§Arguments

  • data - Raw BGRA pixel data (4 bytes per pixel, as from wgpu Bgra8UnormSrgb format)
  • width - Image width in pixels
  • height - Image height in pixels

§Returns

PNG-encoded image data as a byte vector.