Fix edge cases and consistency issues

This commit is contained in:
2026-03-07 19:47:23 +02:00
parent 6bf9d60430
commit 9e1562c4c4
44 changed files with 5748 additions and 2221 deletions

View File

@@ -21,7 +21,7 @@ pub struct ProcessingJob {
pub metadata: Option<MetadataConfig>,
pub watermark: Option<WatermarkConfig>,
pub rename: Option<RenameConfig>,
pub overwrite_behavior: OverwriteBehavior,
pub overwrite_behavior: OverwriteAction,
pub preserve_directory_structure: bool,
pub progressive_jpeg: bool,
pub avif_speed: u8,
@@ -44,11 +44,11 @@ impl ProcessingJob {
metadata: None,
watermark: None,
rename: None,
overwrite_behavior: OverwriteBehavior::default(),
overwrite_behavior: OverwriteAction::default(),
preserve_directory_structure: false,
progressive_jpeg: false,
avif_speed: 6,
output_dpi: 72,
output_dpi: 0,
}
}
@@ -70,6 +70,18 @@ impl ProcessingJob {
count
}
/// Returns true if the job requires decoding/encoding pixel data.
/// When false, we can use a fast copy-and-rename path.
pub fn needs_pixel_processing(&self) -> bool {
self.resize.is_some()
|| matches!(self.rotation, Some(r) if !matches!(r, Rotation::None))
|| matches!(self.flip, Some(f) if !matches!(f, Flip::None))
|| self.adjustments.as_ref().is_some_and(|a| !a.is_noop())
|| self.convert.is_some()
|| self.compress.is_some()
|| self.watermark.is_some()
}
pub fn output_path_for(
&self,
source: &ImageSource,