Apply a camera profile to every raw from the same camera body

A DCP matrix describes the sensor, so a profile chosen for one frame belongs to
all camera-native raws from that body; the panel offers the bulk apply when the
library holds more photos than the one on screen.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
2026-11-28 05:49:47 +00:00
parent 749047ae9e
commit d4cce4e001
4 changed files with 100 additions and 1 deletions
+29
View File
@@ -114,6 +114,35 @@ export function removeCameraProfile(
return next;
}
/** Minimal photo shape needed to pick the raws of one body. */
export interface CameraProfileTarget {
id: string;
raw?: boolean;
decode?: string;
deletedAt?: number;
meta?: { camera?: string };
}
/**
* Every live camera-native raw from the same body, including the one on screen.
* A JPEG, or a raw the server decoded straight to sRGB, already has its colour
* baked in, so a camera profile has nothing to act on there.
*/
export function photosForCamera<T extends CameraProfileTarget>(
photos: T[],
camera?: string,
): T[] {
const key = cameraKey(camera);
if (!key) return [];
return photos.filter(
(photo) =>
photo.raw &&
photo.decode !== 'embedded' &&
!photo.deletedAt &&
cameraKey(photo.meta?.camera) === key,
);
}
/** Profiles that belong to this body, most recently saved first. */
export function savedProfilesForCamera(
profiles: SavedCameraProfile[],