From fc5b2dbf292973b592cc2107960d6f01e8cf664b Mon Sep 17 00:00:00 2001 From: Erin Nova Date: Tue, 15 Feb 2022 15:56:37 -0500 Subject: [PATCH] Add option for output image --- src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index c781d13..a3c24f9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,14 +18,14 @@ struct FloatingImage { } impl FloatingImage { - fn new(width: u32, height: u32, name: String) -> Self { + fn new(width: u32, height: u32, name: &String) -> Self { let buffer_capacity = 3_655_744; let buffer: Vec = Vec::with_capacity(buffer_capacity); FloatingImage { width, height, data: buffer, - name, + name: name.to_string(), } } @@ -49,7 +49,7 @@ fn main() -> Result<(), ImageDataErrors> { println!("{}", &blurhash); let pixels = decode(&blurhash, 50, 50, 1.0).unwrap(); - let mut output = FloatingImage::new(50, 50, "image.png".to_string()); + let mut output = FloatingImage::new(50, 50, &args[2]); output.set_data(pixels)?; image::save_buffer_with_format( output.name,