Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate image;
- use image::GenericImage;
- use std::path::Path;
- use std::fs::File;
- fn main() {
- let (img_x, img_y) = (9 * (7 + 17) + 17, 210 + 17 + 17);
- let mut img_buf = image::ImageBuffer::new(img_x, img_y);
- for (x, y, rgb) in img_buf.enumerate_pixels_mut() {
- *rgb = image::Rgba([0, 0, 0, 255]);
- if x > 17 && (x - 17) % (7 + 17) < 7 && y > 17 && y < 210 + 17 {
- *rgb = image::Rgba([255, 255, 255, 255]);
- }
- }
- let fout = &mut File::create(Path::new("/home/jaday/school/763/hw4prog/img.png")).unwrap();
- image::ImageRgba8(img_buf).save(fout, image::PNG).unwrap();
- }
Advertisement
Add Comment
Please, Sign In to add comment