cosmic::iced_winit::graphics::image::image_rs

Function save_buffer

source
pub fn save_buffer<P>(
    path: P,
    buf: &[u8],
    width: u32,
    height: u32,
    color: ColorType,
) -> Result<(), ImageError>
where P: AsRef<Path>,
Expand description

Saves the supplied buffer to a file at the path specified.

The image format is derived from the file extension. The buffer is assumed to have the correct format according to the specified color type.

This will lead to corrupted files if the buffer contains malformed data. Currently only jpeg, png, ico, pnm, bmp, exr and tiff files are supported.