tmp
This commit is contained in:
parent
22506b4eb5
commit
662e8ee95e
35
src/main.rs
35
src/main.rs
@ -6,7 +6,7 @@ fn main() -> Result<(), Error> {
|
||||
println!("Hello, world!");
|
||||
|
||||
// Open the image
|
||||
let image = Image::<u8, Rgb>::open("/home/sweetbread/nix/screenshot.png")?;
|
||||
// let image = Image::<u8, Rgb>::open("/home/sweetbread/nix/screenshot.png")?;
|
||||
|
||||
// // Show the image
|
||||
// let img = ImageView::new(ImageInfo::rgb8(image.width().try_into().unwrap(), image.height().try_into().unwrap()), image.buffer());
|
||||
@ -23,22 +23,35 @@ fn main() -> Result<(), Error> {
|
||||
// }
|
||||
|
||||
// Create new imahe
|
||||
let mut new_image = image.new_like_with_color::<Hsv>();
|
||||
// let new_image = image.new_like();
|
||||
// let mut new_image = new_image.with_color::<Hsv>();
|
||||
|
||||
for x in 0..image.width() {
|
||||
for y in 0..image.height() {
|
||||
let p = image.get_pixel(Point::new(x, y));
|
||||
let mut hsv_p = Pixel::<Hsv>::new();
|
||||
// for x in 0..image.width() {
|
||||
// for y in 0..image.height() {
|
||||
// let p = image.get_pixel(Point::new(x, y));
|
||||
// let mut hsv_p = Pixel::<Hsv>::new();
|
||||
|
||||
for i in 0..2 {
|
||||
hsv_p[i] = p[i];
|
||||
}
|
||||
// for i in 0..3 {
|
||||
// hsv_p[i] = p[i];
|
||||
// }
|
||||
|
||||
new_image.set_pixel(Point::new(x, y), &hsv_p);
|
||||
// new_image.set_pixel(Point::new(x, y), &hsv_p);
|
||||
// }
|
||||
// }
|
||||
|
||||
// new_image.save("result.png").expect("Failed to save resulting image");
|
||||
|
||||
let mut image = Image::<u8, Hsv>::new(Size::new(100, 100));
|
||||
for x in 0..100 {
|
||||
for y in 0..100 {
|
||||
let mut p = Pixel::<Hsv>::new();
|
||||
p[1] = 1.;
|
||||
p[2] = 1.;
|
||||
image.set_pixel(Point::new(x, y), &p);
|
||||
}
|
||||
}
|
||||
|
||||
new_image.save("result.png").expect("Failed to save resulting image");
|
||||
image.save("result.jpg")?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user