Add option for output image

This commit is contained in:
~erin 2022-02-15 15:56:37 -05:00
parent ab96cf4cb1
commit fc5b2dbf29
1 changed files with 3 additions and 3 deletions

View File

@ -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<u8> = 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,