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

Function save_rgba

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

Source from the content-addressed store, hash-verified

100}
101
102fn save_rgba(bytes: &[u8], w: u32, h: u32, path: &std::path::Path) -> Result<(), Box<dyn std::error::Error>> {
103 let img: image::RgbaImage = image::ImageBuffer::from_raw(w, h, bytes.to_vec())
104 .ok_or("size mismatch packing rgba png")?;
105 img.save(path)?;
106 Ok(())
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())

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected