Show camera profiles in every view and remember proof and DCP settings.

A profile chosen for a raw only changed Develop and exports, so the grid,
Compare and preset previews could disagree with the file. They now grade
camera-native samples, while the proof profile persists with a rendering
intent and DCP matrices can be reused per camera body.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
2026-11-28 04:04:44 +00:00
parent 0c113e7a91
commit 637629385a
16 changed files with 720 additions and 39 deletions
+44 -5
View File
@@ -60,10 +60,12 @@ import {
findProof,
findProofThumb,
findThumb,
findThumb16,
isCustomRoot,
originalTarget,
removeAsset,
removePreview16,
removeThumb16,
setStorageRoot,
storageBytes,
storageRoot,
@@ -72,6 +74,7 @@ import {
writeProof,
writeProofThumb,
writeThumb,
writeThumb16,
} from './storage.mjs';
import { decodeRaw, isRawName, rawSupport } from './raw.mjs';
import {
@@ -84,7 +87,7 @@ import {
purgeExpiredBridges,
verifyBridgeToken,
} from './bridge.mjs';
import { jpegInfo, makeThumb, toJpegProxy } from './imaging.mjs';
import { cameraThumb16, jpegInfo, makeThumb, toJpegProxy } from './imaging.mjs';
import { createZip } from './zip.mjs';
import {
cancelPrune,
@@ -1940,8 +1943,15 @@ route('POST', '/api/photos/:id/original', async ({ req, res, params }) => {
const data = await fsp.readFile(target);
const decoded = await decodeRaw(data);
await writePreview(params.id, decoded.jpeg, decoded.ext);
if (decoded.preview16) await writePreview16(params.id, decoded.preview16.data);
else await removePreview16(params.id);
if (decoded.preview16) {
await writePreview16(params.id, decoded.preview16.data);
// The thumbnail may not exist yet; drop any camera-native tile so the
// first grid view rebuilds it from the new pixels.
await removeThumb16(params.id);
} else {
await removePreview16(params.id);
await removeThumb16(params.id);
}
const info = await jpegInfo(decoded.jpeg);
return json(res, 201, {
raw: true,
@@ -1980,8 +1990,13 @@ route('POST', '/api/photos/:id/reprocess', async ({ req, res, params }) => {
try {
const decoded = await decodeRaw(await fsp.readFile(original));
await writePreview(params.id, decoded.jpeg, decoded.ext);
if (decoded.preview16) await writePreview16(params.id, decoded.preview16.data);
else await removePreview16(params.id);
if (decoded.preview16) {
await writePreview16(params.id, decoded.preview16.data);
await removeThumb16(params.id);
} else {
await removePreview16(params.id);
await removeThumb16(params.id);
}
const thumb = await makeThumb(decoded.jpeg, 560);
if (thumb) await writeThumb(params.id, thumb);
// The old denoised renders were made from the previous proxy.
@@ -2023,6 +2038,30 @@ route('GET', '/api/photos/:id/thumb', async ({ req, res, params }) => {
return sendBuffer(res, data, 'image/jpeg');
});
/**
* Camera-native version of the grid thumbnail, built on first request from the
* 16-bit sidecar and the JPEG thumbnail so the two have identical dimensions.
* Without this the grid can only show the camera profile's effect in Develop.
*/
route('GET', '/api/photos/:id/thumb16', async ({ req, res, params }) => {
const user = currentUser(req);
if (!user) return error(res, 401, 'Not signed in');
if (!ownedBy(photoOwner(params.id), user)) return error(res, 404, 'Not found');
let file = findThumb16(params.id);
if (!file) {
const sidecar = findPreview16(params.id);
const thumb = findThumb(params.id);
if (sidecar && thumb) {
const info = await jpegInfo(await fsp.readFile(thumb));
if (info?.width && info?.height) {
const png = await cameraThumb16(await fsp.readFile(sidecar), info.width, info.height);
if (png) file = await writeThumb16(params.id, png);
}
}
}
return sendFile(req, res, file, 'image/png');
});
/**
* Store a rendered proof for an edited photo. The editable proxy and original
* stay untouched; galleries read this copy so clients see the developed image.