2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-22 19:31:35 +00:00
This commit is contained in:
asonix 2023-09-24 12:42:23 -05:00
parent 9ffdd0432f
commit 8f62b0c325
3 changed files with 6 additions and 7 deletions

View file

@ -31,7 +31,7 @@ where
let output_arg = format!("{}:-", format.magick_format()); let output_arg = format!("{}:-", format.magick_format());
let quality = quality.map(|q| q.to_string()); 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); let mut args: Vec<&str> = Vec::with_capacity(len);
args.push("convert"); args.push("convert");

View file

@ -82,7 +82,7 @@ where
} }
}; };
let processed_reader = crate::magick::process_image_async_read( crate::magick::process_image_async_read(
validated_reader, validated_reader,
magick_args, magick_args,
format, format,
@ -90,9 +90,7 @@ where
quality, quality,
media.process_timeout, media.process_timeout,
) )
.await?; .await?
processed_reader
} else { } else {
validated_reader validated_reader
} }

View file

@ -117,8 +117,9 @@ where
let output_arg = format!("{}:-", format.magick_format()); let output_arg = format!("{}:-", format.magick_format());
let quality = quality.map(|q| q.to_string()); let quality = quality.map(|q| q.to_string());
let len = format.coalesce().then(|| 4).unwrap_or(3) let len = 3
+ quality.is_some().then(|| 1).unwrap_or(0) + if format.coalesce() { 1 } else { 0 }
+ if quality.is_some() { 1 } else { 0 }
+ process_args.len(); + process_args.len();
let mut args: Vec<&str> = Vec::with_capacity(len); let mut args: Vec<&str> = Vec::with_capacity(len);