(bytes: &[u8], w: u32, h: u32, path: &std::path::Path)
| 107 | } |
| 108 | |
| 109 | fn 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 | } |