I want to open an image and set all of its pixels to black. I have this code that compiles but produces an empty transparent png. I was expecting a black image.
extern crate image;
use image::{GenericImageView, ImageBuffer, RgbaImage, imageops, Rgba};
fn main() {
let img = image::open("images/image1.png").unwrap();
let (width, height) = img.dimensions();
let mut out: RgbaImage = ImageBuffer::new(width, height);
for pixel in out.enumerate_pixels_mut() {
*pixel.2 = image::Rgba([255,255,255,1]);
}
out.save("out.png").unwrap();
}