[][src]Function svpng::svpng

pub fn svpng<P: AsRef<Path>>(
    path: P,
    w: u32,
    h: u32,
    pix: &[u8],
    is_alpha: bool
) -> Result<()>

svpng save pixels to png file, color types 2 and 6 (truecolor and truecolor with alpha) are supported

Example:

// RGB
let mut pix = Vec::new();
for y in 0..=255 {
    for x in 0..=255 {
        pix.push(x);
        pix.push(y);
       pix.push(128);
    }
}
svpng("rgb.png", 256, 256, &pix, false)?;