mirror of
https://github.com/osmarks/random-stuff
synced 2025-02-03 12:49:17 +00:00
minor tweak
This commit is contained in:
parent
30a1e0e358
commit
dacc2b19e5
@ -1,4 +1,4 @@
|
||||
use image::{Rgb, ImageBuffer, RgbImage};
|
||||
use image::{Rgb, ImageBuffer, RgbImage, buffer::ConvertBuffer};
|
||||
use std::cmp::{max, min};
|
||||
use nanorand::{WyRand, RNG};
|
||||
use gumdrop::Options;
|
||||
@ -130,10 +130,6 @@ fn main() {
|
||||
}
|
||||
|
||||
// discard low bits of image pixels before saving, as monitors mostly can't render these and it wastes space
|
||||
let low_color_depth_image = RgbImage::from_fn(w, h, |x, y| {
|
||||
let Rgb([r, g, b]) = im.get_pixel(x, y);
|
||||
Rgb([(r >> 8) as u8, (g >> 8) as u8, (b >> 8) as u8])
|
||||
});
|
||||
|
||||
let low_color_depth_image: RgbImage = im.convert();
|
||||
low_color_depth_image.save(&opts.filename).expect("failed to save image");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user