Add image adjustments pipeline (brightness, contrast, crop, effects)
New AdjustmentsConfig with brightness, contrast, saturation, sharpen, grayscale, sepia, crop to aspect ratio, trim whitespace, and canvas padding. All wired from UI through to executor. - Saturation uses luminance-based color blending - Sepia uses standard matrix transformation - Crop calculates center crop from aspect ratio - Trim whitespace detects uniform border by corner pixel comparison - Canvas padding adds white border around image
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
pub mod adjustments;
|
||||
pub mod metadata;
|
||||
pub mod rename;
|
||||
pub mod resize;
|
||||
@@ -195,6 +196,35 @@ pub enum WatermarkConfig {
|
||||
},
|
||||
}
|
||||
|
||||
// --- Adjustments ---
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct AdjustmentsConfig {
|
||||
pub brightness: i32,
|
||||
pub contrast: i32,
|
||||
pub saturation: i32,
|
||||
pub sharpen: bool,
|
||||
pub grayscale: bool,
|
||||
pub sepia: bool,
|
||||
pub crop_aspect_ratio: Option<(f64, f64)>,
|
||||
pub trim_whitespace: bool,
|
||||
pub canvas_padding: u32,
|
||||
}
|
||||
|
||||
impl AdjustmentsConfig {
|
||||
pub fn is_noop(&self) -> bool {
|
||||
self.brightness == 0
|
||||
&& self.contrast == 0
|
||||
&& self.saturation == 0
|
||||
&& !self.sharpen
|
||||
&& !self.grayscale
|
||||
&& !self.sepia
|
||||
&& self.crop_aspect_ratio.is_none()
|
||||
&& !self.trim_whitespace
|
||||
&& self.canvas_padding == 0
|
||||
}
|
||||
}
|
||||
|
||||
// --- Rename ---
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
||||
Reference in New Issue
Block a user