Draw a pixel with rust and image
Since the docs are a bit sparse, this is a very short post on how to draw a pixel:
use image::{ImageBuffer, Rgb};
fn main()
{
let green = [0, 255, 0];
let red = [255, 0, 0];
let mut image = ImageBuffer::<Rgb<u8>, Vec<u8>>::new(200, 200);
image.put_pixel(5,5, Rgb(green));
image.save("output1.png");
for i in 1..100 {
image.put_pixel(i, 5, Rgb(red));
}
image.save("output2.png");
}