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:
2026-03-06 14:24:14 +02:00
parent 8212969e9d
commit f71b55da72
6 changed files with 268 additions and 0 deletions

View File

@@ -1163,6 +1163,34 @@ fn run_processing(_window: &adw::ApplicationWindow, ui: &WizardUi) {
_ => pixstrip_core::operations::Flip::None,
});
// Adjustments
{
let crop = match cfg.crop_aspect_ratio {
1 => Some((1.0, 1.0)),
2 => Some((4.0, 3.0)),
3 => Some((3.0, 2.0)),
4 => Some((16.0, 9.0)),
5 => Some((9.0, 16.0)),
6 => Some((3.0, 4.0)),
7 => Some((2.0, 3.0)),
_ => None,
};
let adj = pixstrip_core::operations::AdjustmentsConfig {
brightness: cfg.brightness,
contrast: cfg.contrast,
saturation: cfg.saturation,
sharpen: cfg.sharpen,
grayscale: cfg.grayscale,
sepia: cfg.sepia,
crop_aspect_ratio: crop,
trim_whitespace: cfg.trim_whitespace,
canvas_padding: cfg.canvas_padding,
};
if !adj.is_noop() {
job.adjustments = Some(adj);
}
}
// Watermark
if cfg.watermark_enabled {
let position = match cfg.watermark_position {