From bdcfb6647c93b423eb4033e02a9bf746bd4406c1 Mon Sep 17 00:00:00 2001 From: SnapOtter Date: Sat, 9 May 2026 11:26:49 +0800 Subject: [PATCH] fix: sync frontend preset multipliers and fix sharpen type error Add clahe and normalise entries to frontend PRESET_MULTIPLIERS to match backend. Fix SharpenOptions to use m1 (not flat) per Sharp 0.34 types. --- .../components/tools/image-enhancement-settings.tsx | 12 ++++++++++++ packages/image-engine/src/operations/auto-enhance.ts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/tools/image-enhancement-settings.tsx b/apps/web/src/components/tools/image-enhancement-settings.tsx index 5bc57c89..3a643765 100644 --- a/apps/web/src/components/tools/image-enhancement-settings.tsx +++ b/apps/web/src/components/tools/image-enhancement-settings.tsx @@ -57,6 +57,8 @@ const PRESET_MULTIPLIERS: Record> = { saturation: 1.0, sharpness: 1.0, denoise: 1.0, + clahe: 1.0, + normalise: 1.0, }, portrait: { brightness: 0.8, @@ -65,6 +67,8 @@ const PRESET_MULTIPLIERS: Record> = { saturation: 0.6, sharpness: 0.5, denoise: 1.5, + clahe: 0.7, + normalise: 0.8, }, landscape: { brightness: 1.0, @@ -73,6 +77,8 @@ const PRESET_MULTIPLIERS: Record> = { saturation: 1.4, sharpness: 1.5, denoise: 0.5, + clahe: 1.3, + normalise: 1.2, }, "low-light": { brightness: 1.8, @@ -81,6 +87,8 @@ const PRESET_MULTIPLIERS: Record> = { saturation: 0.8, sharpness: 1.2, denoise: 2.0, + clahe: 1.5, + normalise: 1.5, }, food: { brightness: 0.8, @@ -89,6 +97,8 @@ const PRESET_MULTIPLIERS: Record> = { saturation: 1.3, sharpness: 1.2, denoise: 0.5, + clahe: 1.1, + normalise: 1.0, }, document: { brightness: 1.5, @@ -97,6 +107,8 @@ const PRESET_MULTIPLIERS: Record> = { saturation: 0.0, sharpness: 2.0, denoise: 2.0, + clahe: 2.0, + normalise: 1.5, }, }; diff --git a/packages/image-engine/src/operations/auto-enhance.ts b/packages/image-engine/src/operations/auto-enhance.ts index d1cde91a..a58ad520 100644 --- a/packages/image-engine/src/operations/auto-enhance.ts +++ b/packages/image-engine/src/operations/auto-enhance.ts @@ -280,7 +280,7 @@ export function applyCorrections( const adj = corrections.sharpness * presets.sharpness * scale; if (adj > 2) { const sigma = 0.5 + (adj / 100) * 4; - result = result.sharpen({ sigma, flat: 1.0 }); + result = result.sharpen({ sigma, m1: 1.0 }); } }