mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: replace enhancement pipeline with CLAHE + normalise + gamma
CLAHE provides adaptive local contrast, normalise stretches the histogram, and gamma adjusts exposure perceptually. Replaces the old modulate/linear pipeline that compounded errors and darkened images. Preset multipliers now include clahe and normalise entries. Key fixes beyond the spec: - maxSlope rounded to integer (Sharp requirement) - White balance uses linear() instead of recomb() to avoid float-cast that breaks CLAHE in the libvips pipeline - CLAHE tile size adapts to image dimensions (1x1 for tiny images) - Gamma clamped to Sharp's valid range (1.0-3.0) - Normalise lower/upper correctly mapped to percentile cutoffs
This commit is contained in:
@@ -33,6 +33,7 @@ async function processImageEnhancement(
|
||||
) {
|
||||
const outputFormat = await resolveOutputFormat(inputBuffer, filename);
|
||||
const analysis = await analyzeImage(inputBuffer);
|
||||
const meta = await sharp(inputBuffer).metadata();
|
||||
|
||||
let image = sharp(inputBuffer);
|
||||
image = applyCorrections(
|
||||
@@ -41,6 +42,7 @@ async function processImageEnhancement(
|
||||
settings.mode,
|
||||
settings.intensity,
|
||||
settings.corrections,
|
||||
{ width: meta.width ?? 1, height: meta.height ?? 1 },
|
||||
);
|
||||
|
||||
const buffer = await image
|
||||
|
||||
Reference in New Issue
Block a user