Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

Write A Pixel To An Image In Rust

This creates a 1x1 pixel image, writes a red pixel to it before saving it

rust
```cargo
[dependencies]
image = "0.25.1"
```

use image::{RgbImage, Rgb};

fn main() {
  let mut img = RgbImage::new(1,1);
  img.put_pixel(0, 0, Rgb([255, 0, 0]));
  match img.save("pixel.png") {
    Ok(_) => println!("Saved image"),
    Err(e) => println!("Error: {}", e)
  }
}
results start

Footnotes And References