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:
@@ -21,8 +21,21 @@ import { getBitmap } from '../lib/images';
|
||||
import { grainSampleWindow, rotatedBounds, Renderer } from '../gl/renderer';
|
||||
import { applyFilmVariant, FILM_VARIANTS, PRESET_CATEGORIES, type FilmVariant } from '../lib/presets';
|
||||
import { usePersistentState } from '../lib/usePersistentState';
|
||||
import { loadProofProfile, setActiveProofCube, type SoftProofCube } from '../lib/softProof';
|
||||
import {
|
||||
clearPersistedProofProfile,
|
||||
loadProofProfile,
|
||||
persistProofProfile,
|
||||
setActiveProofCube,
|
||||
type SoftProofCube,
|
||||
} from '../lib/softProof';
|
||||
import { dcpRgbCam, parseDcp } from '../lib/dcp';
|
||||
import {
|
||||
loadSavedCameraProfiles,
|
||||
removeCameraProfile,
|
||||
saveCameraProfile,
|
||||
savedProfilesForCamera,
|
||||
type SavedCameraProfile,
|
||||
} from '../lib/dcpLibrary';
|
||||
import { usePresetThumbs } from './PresetThumbs';
|
||||
import { availableFor, findLensForMeta, searchLens, type LensSearchResult } from '../lib/lensfun';
|
||||
import {
|
||||
@@ -2178,6 +2191,12 @@ export function CameraProfilePanel({
|
||||
}: PanelSetProps & { cameraNative?: boolean }) {
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const profile = edits.cameraProfile;
|
||||
const camera = photo.meta?.camera ?? '';
|
||||
// Saved per camera body: the matrix describes the sensor, so every frame from
|
||||
// the same body can reuse it without opening the .dcp file again.
|
||||
const [saved, setSaved] = useState<SavedCameraProfile[]>(() => loadSavedCameraProfiles());
|
||||
const matching = useMemo(() => savedProfilesForCamera(saved, camera), [saved, camera]);
|
||||
const applied = matching.find((entry) => entry.name === profile?.name);
|
||||
|
||||
const load = async (file: File) => {
|
||||
if (!cameraNative) return;
|
||||
@@ -2188,6 +2207,7 @@ export function CameraProfilePanel({
|
||||
if (!matrix) throw new Error('This profile has no usable colour matrix');
|
||||
setError(null);
|
||||
set({ cameraProfile: { name: parsed.name, matrix } }, 'Camera profile');
|
||||
setSaved(saveCameraProfile({ name: parsed.name, camera: camera || parsed.camera, matrix }));
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Could not read that profile');
|
||||
}
|
||||
@@ -2219,7 +2239,7 @@ export function CameraProfilePanel({
|
||||
className="btn ghost small"
|
||||
onClick={() => {
|
||||
setError(null);
|
||||
set({ cameraProfile: null }, 'Body camera profile');
|
||||
set({ cameraProfile: null }, 'Body camera matrix');
|
||||
}}
|
||||
>
|
||||
Use body matrix
|
||||
@@ -2227,6 +2247,38 @@ export function CameraProfilePanel({
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{matching.length > 0 && (
|
||||
<label className="field">
|
||||
<span>Saved for this camera</span>
|
||||
<select
|
||||
value=""
|
||||
onChange={(e) => {
|
||||
const entry = matching.find((item) => item.id === e.target.value);
|
||||
if (!entry) return;
|
||||
setError(null);
|
||||
set({ cameraProfile: { name: entry.name, matrix: entry.matrix } }, 'Camera profile');
|
||||
}}
|
||||
>
|
||||
<option value="">Choose a saved profile…</option>
|
||||
{matching.map((entry) => (
|
||||
<option key={entry.id} value={entry.id}>
|
||||
{entry.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
{applied && (
|
||||
<button
|
||||
className="btn ghost small"
|
||||
onClick={() => {
|
||||
setSaved(removeCameraProfile(applied.id));
|
||||
setError(null);
|
||||
}}
|
||||
>
|
||||
Forget saved {applied.name}
|
||||
</button>
|
||||
)}
|
||||
<p className="muted small panel-hint">
|
||||
{!cameraNative
|
||||
? 'This proxy was decoded straight to sRGB, so there are no camera samples to profile. Reprocess the RAW to enable camera profiles.'
|
||||
@@ -2254,7 +2306,10 @@ export function ProofPanel({
|
||||
|
||||
const loadProfile = async (file: File) => {
|
||||
try {
|
||||
const cube = loadProofProfile(new Uint8Array(await file.arrayBuffer()));
|
||||
const bytes = new Uint8Array(await file.arrayBuffer());
|
||||
const cube = loadProofProfile(bytes, 33, proof.intent);
|
||||
// Persisting is best-effort: the cube is live even when IndexedDB is not.
|
||||
void persistProofProfile();
|
||||
setProfileError(null);
|
||||
onProofProfile?.(cube);
|
||||
} catch (err) {
|
||||
@@ -2293,6 +2348,24 @@ export function ProofPanel({
|
||||
<option value="newsprint">Newsprint</option>
|
||||
</select>
|
||||
</label>
|
||||
<label className="field">
|
||||
<span>Rendering intent</span>
|
||||
<select
|
||||
value={proof.intent}
|
||||
onChange={(e) =>
|
||||
set(
|
||||
{ proof: { ...proof, intent: e.target.value as typeof proof.intent } },
|
||||
'Rendering intent',
|
||||
)
|
||||
}
|
||||
disabled={!proof.enabled}
|
||||
title="Which printer table pair the proof uses. Relative colorimetric is what most print shops expect; saturation is often absent from paper profiles and falls back to perceptual."
|
||||
>
|
||||
<option value="perceptual">Perceptual</option>
|
||||
<option value="relative">Relative colorimetric</option>
|
||||
<option value="saturation">Saturation</option>
|
||||
</select>
|
||||
</label>
|
||||
<Slider
|
||||
label="Paper black"
|
||||
min={0}
|
||||
@@ -2324,6 +2397,7 @@ export function ProofPanel({
|
||||
className="btn ghost small"
|
||||
onClick={() => {
|
||||
setActiveProofCube(null);
|
||||
void clearPersistedProofProfile();
|
||||
setProfileError(null);
|
||||
onProofProfile?.(null);
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user