Land camera-native raw profiles, real ICC soft proofing and 16-bit proxies.

Camera profiles, proofing tables and the half-float sidecar all have to agree
with the pixels the editor actually grades, so they land together with the
preset filter menu that was unusable while thumbnails streamed in.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
2026-11-28 03:59:55 +00:00
parent 6dfddffc14
commit 0c113e7a91
53 changed files with 9217 additions and 476 deletions
+61
View File
@@ -0,0 +1,61 @@
import { describe, expect, it } from 'vitest';
import { defaultEdits, normalizeEdits } from './edits';
import { editsToXmp, xmpFileName, xmpToEdits } from './xmp';
describe('xmp sidecars', () => {
it('round-trips every develop field exactly', () => {
const edits = defaultEdits();
edits.exposure = 0.65;
edits.temp = -14;
edits.kelvin = 4200;
edits.contrast = 22;
edits.parametric.darks = -17;
edits.hsl.hue[3] = 12;
edits.grain.roughness = 71;
edits.local = [
{
...defaultEdits().local[0],
kind: 'linear',
linear: { x1: 0.1, y1: 0.2, x2: 0.8, y2: 0.9 },
},
];
const xml = editsToXmp(edits);
const back = xmpToEdits(xml, defaultEdits());
expect(back.source).toBe('luminary');
// Sanitising on the way in is allowed; it must not change any value.
expect(back.edits).toEqual(normalizeEdits(edits));
});
it('reads crs fields written by Lightroom', () => {
const xml = `<?xpacket begin=""?><x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/" crs:Exposure2012="1.25" crs:Contrast2012="-18" crs:Clarity2012="34" crs:GrainAmount="40" crs:ConvertToGrayscale="True"/></rdf:RDF></x:xmpmeta>`;
const base = defaultEdits();
base.saturation = 9;
const result = xmpToEdits(xml, base);
expect(result.source).toBe('lightroom');
expect(result.edits.exposure).toBe(1.25);
expect(result.edits.contrast).toBe(-18);
expect(result.edits.clarity).toBe(34);
expect(result.edits.grain.amount).toBe(40);
expect(result.edits.bw).toBe(true);
// Fields the sidecar does not mention keep the photo's own settings.
expect(result.edits.saturation).toBe(9);
});
it('reads an absolute Kelvin temperature written by Lightroom', () => {
const xml = `<?xpacket begin=""?><x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about="" xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/" crs:Temperature="3800" crs:Tint="12" crs:Exposure2012="0.4"/></rdf:RDF></x:xmpmeta>`;
const result = xmpToEdits(xml, defaultEdits());
expect(result.edits.kelvin).toBe(3800);
expect(result.edits.tint).toBe(12);
expect(result.applied).toContain('Temperature');
});
it('rejects a file that is not a sidecar', () => {
expect(() => xmpToEdits('<html></html>', defaultEdits())).toThrow(/not an XMP/);
});
it('names the sidecar after the photo', () => {
expect(xmpFileName('DSC0123.ARW')).toBe('DSC0123.xmp');
expect(xmpFileName('no-extension')).toBe('no-extension.xmp');
});
});