MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / save_r8

Function save_r8

tools/imposter-baker/src/main.rs:109–114  ·  view source on GitHub ↗
(bytes: &[u8], w: u32, h: u32, path: &std::path::Path)

Source from the content-addressed store, hash-verified

107}
108
109fn save_r8(bytes: &[u8], w: u32, h: u32, path: &std::path::Path) -> Result<(), Box<dyn std::error::Error>> {
110 let img: image::GrayImage = image::ImageBuffer::from_raw(w, h, bytes.to_vec())
111 .ok_or("size mismatch packing r8 png")?;
112 img.save(path)?;
113 Ok(())
114}

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected