Make lens-profile vignetting correction opt-in.
Applying a profile used to enable distortion, CA and vignetting together, and the flat-field gain lifts the already tone-mapped corners above the frame centre, over-exposing the edges. Vignetting now defaults off when a profile is applied or restored from a camera default, and only turns on when a profile explicitly stored vignetting: true.
This commit is contained in:
+5
-1
@@ -421,7 +421,11 @@ function lensProfile(input: unknown): LensProfile | undefined {
|
||||
corrections: {
|
||||
distortion: corrections?.distortion !== false,
|
||||
tca: corrections?.tca !== false,
|
||||
vignetting: corrections?.vignetting !== false,
|
||||
// The vignetting map is a flat-field gain applied to the already
|
||||
// tone-mapped proxy, which pushes the corners brighter than the frame
|
||||
// centre and over-exposes the edges. It stays opt-in, so a profile saved
|
||||
// without an explicit flag never brightens the corners.
|
||||
vignetting: corrections?.vignetting === true,
|
||||
},
|
||||
distance: num(raw.distance, 1000, 0.1, 100000),
|
||||
};
|
||||
|
||||
+4
-1
@@ -85,7 +85,10 @@ function editsForImport(meta: PhotoMeta, defaults: CameraLensDefault[]) {
|
||||
if (match) {
|
||||
edits.lens = {
|
||||
...match.profile,
|
||||
corrections: { ...match.profile.corrections },
|
||||
// A saved default still carries whatever the profile had when it was
|
||||
// stored. Applying it on import must not switch the vignetting gain back
|
||||
// on and over-expose the corners, so that correction stays opt-in.
|
||||
corrections: { ...match.profile.corrections, vignetting: false },
|
||||
};
|
||||
}
|
||||
return edits;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { normalizeEdits } from './edits';
|
||||
import { defaultForMeta, type CameraLensDefault } from './lensDefaults';
|
||||
import type { LensProfile } from '../types';
|
||||
|
||||
@@ -64,4 +65,20 @@ describe('camera-lens default selection', () => {
|
||||
).toBe(newer);
|
||||
});
|
||||
|
||||
it('leaves the vignetting correction off unless the profile asked for it', () => {
|
||||
// Older saved profiles carry no corrections block at all; the flat-field
|
||||
// gain would brighten the corners past the frame centre if it defaulted on.
|
||||
const legacy = normalizeEdits({ lens: { maker: 'Nikon', model: 'Nikkor 50mm', crop: 1 } } as never);
|
||||
expect(legacy.lens?.corrections).toEqual({ distortion: true, tca: true, vignetting: false });
|
||||
|
||||
const optedIn = normalizeEdits({
|
||||
lens: {
|
||||
maker: 'Nikon',
|
||||
model: 'Nikkor 50mm',
|
||||
crop: 1,
|
||||
corrections: { distortion: true, tca: true, vignetting: true },
|
||||
},
|
||||
} as never);
|
||||
expect(optedIn.lens?.corrections.vignetting).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user