diff --git a/src/generate/magick.rs b/src/generate/magick.rs index 3834355..5776a87 100644 --- a/src/generate/magick.rs +++ b/src/generate/magick.rs @@ -31,7 +31,7 @@ where let output_arg = format!("{}:-", format.magick_format()); let quality = quality.map(|q| q.to_string()); - let len = format.coalesce().then(|| 4).unwrap_or(3) + quality.is_some().then(|| 1).unwrap_or(0); + let len = 3 + if format.coalesce() { 1 } else { 0 } + if quality.is_some() { 1 } else { 0 }; let mut args: Vec<&str> = Vec::with_capacity(len); args.push("convert"); diff --git a/src/ingest.rs b/src/ingest.rs index c2fc9e5..40c353d 100644 --- a/src/ingest.rs +++ b/src/ingest.rs @@ -82,7 +82,7 @@ where } }; - let processed_reader = crate::magick::process_image_async_read( + crate::magick::process_image_async_read( validated_reader, magick_args, format, @@ -90,9 +90,7 @@ where quality, media.process_timeout, ) - .await?; - - processed_reader + .await? } else { validated_reader } diff --git a/src/magick.rs b/src/magick.rs index d08fef3..41a6b91 100644 --- a/src/magick.rs +++ b/src/magick.rs @@ -117,8 +117,9 @@ where let output_arg = format!("{}:-", format.magick_format()); let quality = quality.map(|q| q.to_string()); - let len = format.coalesce().then(|| 4).unwrap_or(3) - + quality.is_some().then(|| 1).unwrap_or(0) + let len = 3 + + if format.coalesce() { 1 } else { 0 } + + if quality.is_some() { 1 } else { 0 } + process_args.len(); let mut args: Vec<&str> = Vec::with_capacity(len);