Wire resize algorithm selection, overwrite behavior, and fix rotation/flip scope

- Add ResizeAlgorithm enum (Lanczos3/CatmullRom/Bilinear/Nearest) to core
- Thread algorithm selection from UI ComboRow through ProcessingJob to resize_image
- Add OverwriteBehavior enum (AutoRename/Overwrite/Skip) to core
- Implement overwrite handling in executor with auto-rename suffix logic
- Wire overwrite behavior from output step through to processing job
- Fix rotation/flip to apply when resize step is enabled, not just adjustments
This commit is contained in:
2026-03-06 15:17:59 +02:00
parent 064194df3d
commit a29256921e
7 changed files with 123 additions and 6 deletions

View File

@@ -3,11 +3,19 @@ use fast_image_resize::{images::Image, Resizer, ResizeOptions, ResizeAlg, Filter
use crate::error::{PixstripError, Result};
use crate::types::Dimensions;
use super::ResizeConfig;
use super::{ResizeConfig, ResizeAlgorithm};
pub fn resize_image(
src: &image::DynamicImage,
config: &ResizeConfig,
) -> Result<image::DynamicImage> {
resize_image_with_algorithm(src, config, ResizeAlgorithm::default())
}
pub fn resize_image_with_algorithm(
src: &image::DynamicImage,
config: &ResizeConfig,
algorithm: ResizeAlgorithm,
) -> Result<image::DynamicImage> {
let original = Dimensions {
width: src.width(),
@@ -40,7 +48,13 @@ pub fn resize_image(
);
let mut resizer = Resizer::new();
let options = ResizeOptions::new().resize_alg(ResizeAlg::Convolution(FilterType::Lanczos3));
let alg = match algorithm {
ResizeAlgorithm::Lanczos3 => ResizeAlg::Convolution(FilterType::Lanczos3),
ResizeAlgorithm::CatmullRom => ResizeAlg::Convolution(FilterType::CatmullRom),
ResizeAlgorithm::Bilinear => ResizeAlg::Convolution(FilterType::Bilinear),
ResizeAlgorithm::Nearest => ResizeAlg::Nearest,
};
let options = ResizeOptions::new().resize_alg(alg);
resizer
.resize(&src_image, &mut dst_image, &options)