Files
glenloch-media/lumenroom/src/lib/presets.ts
T
bhursey 0cb315ea88
CI / build (push) Has been cancelled
feat(editor): bridge the advanced photo editor into the event workflow
Event photos can now be opened in Lumenroom, a WebGL2 develop module, from the
photo editor's Advanced button. The dashboard signs a short-lived token scoped
to one user and event; Lumenroom exchanges it, imports the event's photo list
and proxies bytes on demand, so nothing is copied and the temporary catalog
expires with the bridge session. Saving in Lumenroom renders the photo and
writes it back as the event's edited JPEG, with the advanced recipe kept in
event_photos.advanced_edit_json.

Lumenroom is vendored under lumenroom/ and built as a second compose service,
so one clone and `docker compose up -d --build` deploys both apps.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-21 01:34:20 +00:00

1172 lines
28 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { BwFilter, Edits, Preset } from '../types';
const identity = () => [
{ x: 0, y: 0 },
{ x: 1, y: 1 },
];
/* --------------------------------------------------------------- film pack */
type Band = 'red' | 'orange' | 'yellow' | 'green' | 'aqua' | 'blue' | 'purple' | 'magenta';
const BAND_ORDER: Band[] = ['red', 'orange', 'yellow', 'green', 'aqua', 'blue', 'purple', 'magenta'];
interface BandShift {
hue?: number;
sat?: number;
lum?: number;
}
function mix(shifts: Partial<Record<Band, BandShift>>): Edits['hsl'] {
return {
hue: BAND_ORDER.map((b) => shifts[b]?.hue ?? 0),
sat: BAND_ORDER.map((b) => shifts[b]?.sat ?? 0),
lum: BAND_ORDER.map((b) => shifts[b]?.lum ?? 0),
};
}
interface FilmSpec {
id: string;
name: string;
group: string;
/** black & white stock */
bw?: boolean;
/** contrast filter used with the stock */
filter?: BwFilter;
temp?: number;
tint?: number;
contrast?: number;
highlights?: number;
shadows?: number;
whites?: number;
blacks?: number;
texture?: number;
clarity?: number;
dehaze?: number;
vibrance?: number;
saturation?: number;
curve?: [number, number][];
hsl?: Partial<Record<Band, BandShift>>;
grade?: { shadows?: [number, number]; highlights?: [number, number]; balance?: number };
/** amount, size, and optionally roughness */
grain?: [number, number, number?];
vignette?: number;
vignetteMid?: number;
}
/** A film look replaces the full colour/tone treatment (exposure stays yours). */
function film(f: FilmSpec): Preset {
const curve = f.curve
? { rgb: f.curve.map(([x, y]) => ({ x, y })), red: identity(), green: identity(), blue: identity() }
: { rgb: identity(), red: identity(), green: identity(), blue: identity() };
const edits: Preset['edits'] = {
temp: f.temp ?? 0,
tint: f.tint ?? 0,
contrast: f.contrast ?? 0,
highlights: f.highlights ?? 0,
shadows: f.shadows ?? 0,
whites: f.whites ?? 0,
blacks: f.blacks ?? 0,
texture: f.texture ?? 0,
clarity: f.clarity ?? 0,
dehaze: f.dehaze ?? 0,
vibrance: f.vibrance ?? 0,
saturation: f.saturation ?? 0,
bw: !!f.bw,
bwFilter: f.bw ? f.filter ?? 'none' : 'none',
bwFilterAmount: 100,
curve,
hsl: mix(f.hsl ?? {}),
grading: {
shadows: { h: f.grade?.shadows?.[0] ?? 210, s: f.grade?.shadows?.[1] ?? 0 },
highlights: { h: f.grade?.highlights?.[0] ?? 45, s: f.grade?.highlights?.[1] ?? 0 },
balance: f.grade?.balance ?? 0,
},
grain: { amount: f.grain?.[0] ?? 0, size: f.grain?.[1] ?? 25, roughness: f.grain?.[2] ?? 55 },
vignette: { amount: f.vignette ?? 0, midpoint: f.vignetteMid ?? 45, feather: 60 },
};
return { id: f.id, name: f.name, group: f.group, edits };
}
/** S-curve used by most slide films: deep blacks, bright but clean highlights. */
const SLIDE: [number, number][] = [
[0, 0.02],
[0.25, 0.2],
[0.75, 0.82],
[1, 0.99],
];
/** Soft shoulder used by colour negative print films. */
const PRINT: [number, number][] = [
[0, 0.02],
[0.3, 0.29],
[0.75, 0.77],
[1, 0.98],
];
/** Lifted blacks of instant film. */
const INSTANT: [number, number][] = [
[0, 0.09],
[0.5, 0.52],
[1, 0.95],
];
const FILM_PACK: FilmSpec[] = [
/* ----------------------------------------------------------------- Kodak */
{
id: 'film-portra-160',
name: 'Kodak Portra 160',
group: 'Kodak',
temp: 4,
contrast: -6,
highlights: -8,
shadows: 10,
vibrance: 8,
saturation: -4,
curve: PRINT,
hsl: { orange: { sat: -4, lum: 5 }, green: { sat: -6 }, blue: { sat: -4 } },
grade: { shadows: [212, 4], highlights: [40, 8] },
grain: [10, 24],
},
{
id: 'film-portra-400',
name: 'Kodak Portra 400',
group: 'Kodak',
temp: 6,
contrast: -2,
highlights: -10,
shadows: 8,
vibrance: 10,
saturation: -2,
curve: PRINT,
hsl: { orange: { sat: 5, lum: 6 }, green: { sat: -4 }, blue: { sat: -2 } },
grade: { shadows: [215, 5], highlights: [42, 9] },
grain: [16, 28],
},
{
id: 'film-portra-800',
name: 'Kodak Portra 800',
group: 'Kodak',
temp: 8,
contrast: 2,
highlights: -8,
shadows: 10,
vibrance: 8,
saturation: -4,
curve: PRINT,
hsl: { orange: { sat: 6, lum: 8 }, green: { sat: -6 } },
grade: { shadows: [216, 6], highlights: [44, 10] },
grain: [26, 32],
},
{
id: 'film-ektar-100',
name: 'Kodak Ektar 100',
group: 'Kodak',
contrast: 18,
blacks: -10,
vibrance: 26,
saturation: 8,
clarity: 6,
curve: SLIDE,
hsl: { red: { sat: 12 }, green: { sat: 6, hue: -4 }, blue: { sat: 14, lum: -4 }, aqua: { sat: 8 } },
grade: { shadows: [214, 6], highlights: [45, 4] },
grain: [6, 22],
},
{
id: 'film-gold-200',
name: 'Kodak Gold 200',
group: 'Kodak',
temp: 14,
contrast: 6,
highlights: -10,
shadows: 6,
vibrance: 14,
saturation: 6,
curve: PRINT,
hsl: { orange: { sat: 10, lum: 6 }, yellow: { sat: 8 }, green: { sat: -6 } },
grade: { shadows: [35, 6], highlights: [45, 12] },
grain: [14, 28],
},
{
id: 'film-colorplus-200',
name: 'Kodak ColorPlus 200',
group: 'Kodak',
temp: 18,
tint: 4,
contrast: 4,
highlights: -6,
shadows: 8,
saturation: 8,
vibrance: 10,
curve: PRINT,
hsl: { orange: { sat: 12, lum: 5 }, yellow: { sat: 10 }, aqua: { sat: -6 } },
grade: { shadows: [38, 8], highlights: [46, 12] },
grain: [18, 30],
},
{
id: 'film-ultramax-400',
name: 'Kodak Ultramax 400',
group: 'Kodak',
temp: 12,
contrast: 8,
blacks: -6,
vibrance: 18,
saturation: 4,
curve: PRINT,
hsl: { orange: { sat: 8 }, yellow: { sat: 6 }, blue: { sat: 10 }, green: { sat: -4 } },
grade: { shadows: [30, 6], highlights: [44, 10] },
grain: [20, 30],
},
{
id: 'film-pro-image-100',
name: 'Kodak Pro Image 100',
group: 'Kodak',
temp: 6,
contrast: 10,
shadows: 4,
vibrance: 12,
saturation: 2,
curve: PRINT,
hsl: { orange: { sat: 6, lum: 4 }, blue: { sat: 4 } },
grade: { shadows: [205, 4], highlights: [42, 8] },
grain: [8, 24],
},
{
id: 'film-ektachrome-e100',
name: 'Kodak Ektachrome E100',
group: 'Kodak',
temp: -6,
contrast: 20,
highlights: -10,
blacks: -8,
saturation: 4,
vibrance: 16,
clarity: 4,
curve: SLIDE,
hsl: { blue: { sat: 12 }, green: { sat: 6 }, red: { sat: 6 } },
grade: { shadows: [220, 8], highlights: [48, 4] },
grain: [6, 22],
},
{
id: 'film-kodachrome-25',
name: 'Kodak Kodachrome 25',
group: 'Kodak',
temp: 8,
contrast: 20,
blacks: -12,
vibrance: 6,
saturation: -4,
curve: SLIDE,
hsl: { red: { sat: 16, hue: -4 }, orange: { sat: 10, lum: 4 }, blue: { sat: -12, hue: 4 } },
grade: { shadows: [210, 8], highlights: [44, 6] },
grain: [5, 20],
},
{
id: 'film-kodachrome-64',
name: 'Kodak Kodachrome 64',
group: 'Kodak',
temp: 8,
contrast: 16,
blacks: -10,
vibrance: 6,
saturation: -4,
curve: SLIDE,
hsl: { red: { sat: 16, hue: -4 }, orange: { sat: 10, lum: 4 }, blue: { sat: -12, hue: 4 } },
grade: { shadows: [210, 7], highlights: [44, 6] },
grain: [9, 24],
},
{
id: 'film-kodachrome-200',
name: 'Kodak Kodachrome 200',
group: 'Kodak',
temp: 8,
contrast: 12,
blacks: -8,
vibrance: 4,
saturation: -6,
curve: PRINT,
hsl: { red: { sat: 14 }, orange: { sat: 8, lum: 5 }, blue: { sat: -10 } },
grade: { shadows: [212, 8], highlights: [44, 6] },
grain: [20, 30],
},
{
id: 'film-tri-x-400',
name: 'Kodak Tri-X 400',
group: 'Kodak',
bw: true,
filter: 'yellow',
contrast: 22,
blacks: -12,
whites: 10,
clarity: 8,
curve: SLIDE,
grain: [26, 32],
},
{
id: 'film-tri-x-320',
name: 'Kodak Tri-X 320',
group: 'Kodak',
bw: true,
filter: 'yellow',
contrast: 18,
blacks: -10,
whites: 8,
curve: PRINT,
grain: [22, 30],
},
{
id: 'film-tmax-100',
name: 'Kodak T-Max 100',
group: 'Kodak',
bw: true,
filter: 'none',
contrast: 16,
blacks: -8,
clarity: 8,
curve: SLIDE,
grain: [6, 22],
},
{
id: 'film-tmax-400',
name: 'Kodak T-Max 400',
group: 'Kodak',
bw: true,
filter: 'none',
contrast: 14,
blacks: -6,
clarity: 6,
curve: SLIDE,
grain: [14, 26],
},
{
id: 'film-tmax-3200',
name: 'Kodak T-Max 3200',
group: 'Kodak',
bw: true,
filter: 'none',
contrast: 20,
shadows: 10,
blacks: -8,
curve: PRINT,
grain: [40, 38],
},
{
id: 'film-plus-x-125',
name: 'Kodak Plus-X 125',
group: 'Kodak',
bw: true,
filter: 'yellow',
contrast: 12,
curve: PRINT,
grain: [8, 24],
},
{
id: 'film-bw400cn',
name: 'Kodak BW400CN',
group: 'Kodak',
bw: true,
filter: 'none',
contrast: 6,
highlights: -8,
curve: PRINT,
grain: [10, 26],
},
/* -------------------------------------------------------------- Fujifilm */
{
id: 'film-pro-400h',
name: 'Fujifilm Pro 400H',
group: 'Fujifilm',
temp: -6,
tint: 4,
contrast: -10,
highlights: -6,
shadows: 12,
vibrance: 6,
saturation: -10,
curve: PRINT,
hsl: { green: { hue: 6, sat: 8 }, aqua: { hue: 4, sat: 6 }, orange: { lum: 6, sat: -4 } },
grade: { shadows: [190, 8], highlights: [50, 6] },
grain: [12, 26],
},
{
id: 'film-superia-400',
name: 'Fujifilm Superia 400',
group: 'Fujifilm',
temp: -4,
contrast: 10,
vibrance: 16,
saturation: 4,
curve: PRINT,
hsl: { green: { sat: 12, hue: -6 }, aqua: { sat: 8, hue: -4 }, red: { sat: 6 } },
grade: { shadows: [195, 8], highlights: [48, 6] },
grain: [20, 30],
},
{
id: 'film-superia-200',
name: 'Fujifilm Superia 200',
group: 'Fujifilm',
temp: -2,
contrast: 8,
vibrance: 14,
saturation: 2,
curve: PRINT,
hsl: { green: { sat: 10, hue: -4 }, aqua: { sat: 6 } },
grade: { shadows: [196, 7], highlights: [48, 6] },
grain: [13, 26],
},
{
id: 'film-c200',
name: 'Fujifilm C200',
group: 'Fujifilm',
tint: 2,
contrast: 6,
vibrance: 12,
saturation: 2,
curve: PRINT,
hsl: { green: { sat: 8, hue: 4 }, blue: { sat: 6 } },
grade: { shadows: [200, 6], highlights: [50, 5] },
grain: [14, 28],
},
{
id: 'film-pro-neg-hi',
name: 'Fujifilm Pro Neg Hi',
group: 'Fujifilm',
temp: -2,
contrast: 14,
shadows: 8,
vibrance: 8,
saturation: -2,
curve: PRINT,
hsl: { green: { sat: 6 }, orange: { lum: 4 } },
grade: { shadows: [198, 6], highlights: [46, 6] },
grain: [8, 24],
},
{
id: 'film-pro-neg-std',
name: 'Fujifilm Pro Neg Std',
group: 'Fujifilm',
contrast: 2,
highlights: -6,
shadows: 12,
saturation: -12,
vibrance: 4,
curve: PRINT,
hsl: { green: { sat: 4 }, orange: { lum: 6 } },
grade: { shadows: [200, 6], highlights: [48, 4] },
grain: [8, 24],
},
{
id: 'film-velvia-50',
name: 'Fujifilm Velvia 50',
group: 'Fujifilm',
temp: -8,
contrast: 26,
blacks: -14,
clarity: 8,
vibrance: 34,
saturation: 18,
curve: SLIDE,
hsl: {
red: { sat: 18 },
orange: { sat: 10 },
yellow: { sat: 12 },
green: { sat: 20, hue: -8 },
aqua: { sat: 12 },
blue: { sat: 14 },
},
grain: [5, 20],
},
{
id: 'film-velvia-100',
name: 'Fujifilm Velvia 100',
group: 'Fujifilm',
temp: -7,
contrast: 24,
blacks: -12,
clarity: 6,
vibrance: 30,
saturation: 14,
curve: SLIDE,
hsl: {
red: { sat: 16 },
yellow: { sat: 10 },
green: { sat: 18, hue: -6 },
aqua: { sat: 10 },
blue: { sat: 12 },
},
grain: [8, 22],
},
{
id: 'film-provia-100f',
name: 'Fujifilm Provia 100F',
group: 'Fujifilm',
temp: -2,
contrast: 16,
blacks: -8,
vibrance: 18,
saturation: 6,
curve: SLIDE,
hsl: { blue: { sat: 8 }, green: { sat: 6 }, red: { sat: 6 } },
grain: [6, 22],
},
{
id: 'film-astia-100f',
name: 'Fujifilm Astia 100F',
group: 'Fujifilm',
temp: 2,
contrast: 6,
highlights: -6,
shadows: 8,
vibrance: 10,
saturation: -6,
curve: PRINT,
hsl: { orange: { lum: 6, sat: 4 }, green: { sat: 4 }, blue: { sat: -4 } },
grade: { shadows: [205, 4], highlights: [45, 5] },
grain: [6, 22],
},
{
id: 'film-fortia-sp',
name: 'Fujifilm Fortia SP',
group: 'Fujifilm',
temp: -4,
contrast: 20,
blacks: -10,
vibrance: 30,
saturation: 24,
curve: SLIDE,
hsl: { green: { sat: 18 }, red: { sat: 20 }, blue: { sat: 16 }, magenta: { sat: 12 } },
grain: [6, 22],
},
{
id: 'film-acros-100-ii',
name: 'Fujifilm Acros 100 II',
group: 'Fujifilm',
bw: true,
filter: 'none',
contrast: 14,
blacks: -10,
clarity: 6,
curve: SLIDE,
grain: [4, 20],
},
{
id: 'film-neopan-400',
name: 'Fujifilm Neopan 400',
group: 'Fujifilm',
bw: true,
filter: 'yellow',
contrast: 12,
curve: PRINT,
grain: [18, 28],
},
{
id: 'film-neopan-1600',
name: 'Fujifilm Neopan 1600',
group: 'Fujifilm',
bw: true,
filter: 'none',
contrast: 16,
shadows: 8,
curve: PRINT,
grain: [34, 34],
},
/* ---------------------------------------------------------------- Ilford */
{
id: 'film-hp5-plus-400',
name: 'Ilford HP5 Plus 400',
group: 'Ilford',
bw: true,
filter: 'yellow',
contrast: 14,
blacks: -8,
clarity: 6,
curve: PRINT,
grain: [24, 32],
},
{
id: 'film-fp4-plus-125',
name: 'Ilford FP4 Plus 125',
group: 'Ilford',
bw: true,
filter: 'yellow',
contrast: 12,
curve: PRINT,
grain: [10, 26],
},
{
id: 'film-delta-100',
name: 'Ilford Delta 100',
group: 'Ilford',
bw: true,
filter: 'none',
contrast: 16,
blacks: -8,
clarity: 6,
curve: SLIDE,
grain: [6, 22],
},
{
id: 'film-delta-400',
name: 'Ilford Delta 400',
group: 'Ilford',
bw: true,
filter: 'none',
contrast: 16,
blacks: -6,
curve: SLIDE,
grain: [14, 26],
},
{
id: 'film-delta-3200',
name: 'Ilford Delta 3200',
group: 'Ilford',
bw: true,
filter: 'none',
contrast: 18,
shadows: 12,
blacks: -10,
curve: PRINT,
grain: [44, 38],
},
{
id: 'film-pan-f-plus-50',
name: 'Ilford Pan F Plus 50',
group: 'Ilford',
bw: true,
filter: 'orange',
contrast: 18,
blacks: -10,
clarity: 10,
curve: SLIDE,
grain: [4, 20],
},
{
id: 'film-xp2-super-400',
name: 'Ilford XP2 Super 400',
group: 'Ilford',
bw: true,
filter: 'yellow',
contrast: 8,
highlights: -8,
shadows: 6,
curve: PRINT,
grain: [10, 26],
},
{
id: 'film-ortho-plus-80',
name: 'Ilford Ortho Plus 80',
group: 'Ilford',
bw: true,
filter: 'green',
contrast: 18,
clarity: 8,
curve: SLIDE,
grain: [5, 20],
},
/* ------------------------------------------------------------------ Agfa */
{
id: 'film-vista-200',
name: 'Agfa Vista 200',
group: 'Agfa',
temp: 8,
contrast: 6,
vibrance: 12,
saturation: 4,
curve: PRINT,
hsl: { green: { sat: 10, hue: -6 }, red: { sat: 8 }, blue: { sat: 6 } },
grade: { shadows: [30, 6], highlights: [45, 8] },
grain: [18, 30],
},
{
id: 'film-ultra-100',
name: 'Agfa Ultra 100',
group: 'Agfa',
temp: 4,
contrast: 14,
vibrance: 20,
saturation: 26,
curve: SLIDE,
hsl: { red: { sat: 18 }, blue: { sat: 12 }, green: { sat: 8 } },
grain: [8, 24],
},
{
id: 'film-apx-100',
name: 'Agfa APX 100',
group: 'Agfa',
bw: true,
filter: 'yellow',
contrast: 14,
blacks: -6,
curve: PRINT,
grain: [14, 26],
},
{
id: 'film-apx-400',
name: 'Agfa APX 400',
group: 'Agfa',
bw: true,
filter: 'yellow',
contrast: 10,
curve: PRINT,
grain: [26, 32],
},
{
id: 'film-scala-200x',
name: 'Agfa Scala 200X',
group: 'Agfa',
bw: true,
filter: 'none',
contrast: 20,
blacks: -12,
clarity: 8,
curve: SLIDE,
grain: [8, 22],
},
/* -------------------------------------------------------------- CineStill */
{
id: 'film-cinestill-50d',
name: 'CineStill 50D',
group: 'CineStill',
temp: -4,
contrast: 12,
highlights: -8,
vibrance: 16,
saturation: 4,
curve: PRINT,
hsl: { green: { hue: 4, sat: 6 }, aqua: { sat: 6 }, blue: { sat: 6 } },
grade: { shadows: [200, 6], highlights: [46, 6] },
grain: [8, 24],
},
{
id: 'film-cinestill-800t',
name: 'CineStill 800T',
group: 'CineStill',
temp: -26,
tint: -6,
contrast: 10,
shadows: 8,
vibrance: 12,
saturation: 2,
curve: PRINT,
hsl: { blue: { sat: 10, hue: 4 }, aqua: { sat: 12 }, red: { sat: 8 } },
grade: { shadows: [200, 24], highlights: [40, 10] },
grain: [22, 30],
},
/* ------------------------------------------------------------ Lomography */
{
id: 'film-lomocolor-100',
name: 'Lomography Color Negative 100',
group: 'Lomography',
temp: 6,
contrast: 18,
vibrance: 20,
saturation: 14,
curve: SLIDE,
hsl: { green: { sat: 14 }, blue: { sat: 10 }, red: { sat: 8 } },
grade: { shadows: [220, 10], highlights: [45, 6] },
vignette: -24,
grain: [16, 28],
},
{
id: 'film-lomocolor-400',
name: 'Lomography Color Negative 400',
group: 'Lomography',
temp: 4,
contrast: 14,
vibrance: 16,
saturation: 10,
curve: PRINT,
hsl: { green: { sat: 10 }, blue: { sat: 8 } },
grade: { shadows: [225, 12], highlights: [45, 6] },
vignette: -30,
grain: [26, 32],
},
{
id: 'film-lomochrome-purple',
name: 'LomoChrome Purple',
group: 'Lomography',
contrast: 12,
vibrance: 14,
saturation: 6,
curve: PRINT,
hsl: { green: { hue: 60, sat: 20 }, yellow: { hue: 50 }, aqua: { hue: 40, sat: 16 }, red: { hue: -12 } },
grade: { shadows: [285, 26], highlights: [320, 10] },
grain: [16, 28],
},
{
id: 'film-lomochrome-metropolis',
name: 'LomoChrome Metropolis',
group: 'Lomography',
contrast: 16,
highlights: -8,
vibrance: 2,
saturation: -38,
curve: PRINT,
hsl: { green: { sat: -20 }, blue: { sat: -12 }, orange: { sat: -8 } },
grade: { shadows: [190, 14], highlights: [40, 6] },
grain: [14, 26],
},
/* --------------------------------------------------------- Polaroid/instant */
{
id: 'film-polaroid-600',
name: 'Polaroid 600',
group: 'Polaroid & Instant',
temp: 10,
contrast: -12,
highlights: -6,
shadows: 22,
blacks: 26,
saturation: -18,
vibrance: 4,
curve: INSTANT,
hsl: { orange: { lum: 6, sat: 6 }, blue: { sat: -10 }, green: { sat: -12 } },
grade: { shadows: [200, 10], highlights: [45, 10] },
vignette: -14,
grain: [20, 34],
},
{
id: 'film-polaroid-sx70',
name: 'Polaroid SX-70',
group: 'Polaroid & Instant',
temp: 14,
contrast: -16,
highlights: -4,
shadows: 26,
blacks: 34,
saturation: -24,
curve: [[0, 0.12], [0.5, 0.55], [1, 0.94]],
hsl: { orange: { lum: 8, sat: 8 }, blue: { sat: -12, lum: 4 }, green: { sat: -14 } },
grade: { shadows: [42, 12], highlights: [48, 12] },
vignette: -16,
vignetteMid: 40,
grain: [24, 36],
},
{
id: 'film-instax-mini',
name: 'Fujifilm Instax Mini',
group: 'Polaroid & Instant',
temp: 2,
contrast: -4,
highlights: -8,
shadows: 10,
vibrance: 12,
saturation: 6,
curve: PRINT,
hsl: { aqua: { sat: 8 }, green: { sat: 6 }, orange: { lum: 4 } },
grade: { shadows: [195, 6], highlights: [50, 6] },
grain: [8, 24],
},
/* -------------------------------------------------------- Rollei & Bergger */
{
id: 'film-rollei-retro-80s',
name: 'Rollei Retro 80S',
group: 'Rollei & Bergger',
bw: true,
filter: 'orange',
contrast: 20,
blacks: -10,
clarity: 10,
curve: SLIDE,
grain: [8, 22],
},
{
id: 'film-rollei-infrared-400',
name: 'Rollei Infrared 400',
group: 'Rollei & Bergger',
bw: true,
filter: 'red',
contrast: 24,
blacks: -12,
clarity: 8,
curve: SLIDE,
hsl: { green: { lum: 30 }, yellow: { lum: 18 }, blue: { lum: -14 } },
grain: [18, 30],
},
{
id: 'film-bergger-pancro-400',
name: 'Bergger Pancro 400',
group: 'Rollei & Bergger',
bw: true,
filter: 'yellow',
contrast: 12,
shadows: 6,
curve: PRINT,
grain: [22, 30],
},
];
export const FILM_PRESETS: Preset[] = FILM_PACK.map(film);
/* --------------------------------------------------------------- essentials */
export const PRESETS: Preset[] = [
{
id: 'original',
name: 'Original',
group: 'Essentials',
edits: {},
},
{
id: 'punch',
name: 'Punch',
group: 'Essentials',
edits: { contrast: 26, clarity: 18, vibrance: 24, blacks: -12, highlights: -12, whites: 8 },
},
{
id: 'matte-fade',
name: 'Matte Fade',
group: 'Film',
edits: {
contrast: -8,
shadows: 26,
blacks: 30,
saturation: -14,
curve: { rgb: [{ x: 0, y: 0.075 }, { x: 0.55, y: 0.55 }, { x: 1, y: 0.975 }], red: identity(), green: identity(), blue: identity() },
},
},
{
id: 'golden-hour',
name: 'Golden Hour',
group: 'Warm',
edits: {
temp: 26,
exposure: 0.12,
highlights: -16,
shadows: 12,
vibrance: 18,
grading: { shadows: { h: 32, s: 8 }, highlights: { h: 42, s: 24 }, balance: 0 },
},
},
{
id: 'cool-cinema',
name: 'Cool Cinema',
group: 'Cinematic',
edits: {
temp: -18,
tint: 6,
contrast: 16,
shadows: 14,
saturation: -8,
blacks: -8,
grading: { shadows: { h: 214, s: 26 }, highlights: { h: 40, s: 16 }, balance: 10 },
},
},
{
id: 'film-chrome',
name: 'Film Chrome',
group: 'Film',
edits: {
contrast: 10,
clarity: -6,
vibrance: 12,
grain: { amount: 24, size: 28, roughness: 55 },
curve: {
rgb: [
{ x: 0, y: 0.03 },
{ x: 0.25, y: 0.2 },
{ x: 0.75, y: 0.8 },
{ x: 1, y: 0.98 },
],
red: identity(),
green: identity(),
blue: identity(),
},
},
},
{
id: 'vivid-landscape',
name: 'Vivid Landscape',
group: 'Outdoor',
edits: {
texture: 12,
clarity: 20,
dehaze: 12,
vibrance: 28,
saturation: 6,
highlights: -22,
shadows: 18,
hsl: {
hue: [0, 0, 0, 4, 0, 0, 0, 0],
sat: [0, 0, 6, 12, 8, 14, 0, 0],
lum: [0, 0, 0, -4, 0, -6, 0, 0],
},
},
},
{
id: 'portrait-warm',
name: 'Portrait Warm',
group: 'Portrait',
edits: {
temp: 12,
texture: -8,
clarity: -6,
shadows: 10,
vibrance: 10,
hsl: {
hue: [0, 2, 0, 0, 0, 0, 0, 0],
sat: [0, 8, 0, 0, 0, 0, 0, 0],
lum: [0, 6, 0, 0, 0, 0, 0, 0],
},
grading: { shadows: { h: 210, s: 6 }, highlights: { h: 38, s: 12 }, balance: 0 },
},
},
{
id: 'bw-contrast',
name: 'B&W Contrast',
group: 'Black & White',
edits: {
bw: true,
bwFilter: 'yellow',
bwFilterAmount: 100,
contrast: 26,
clarity: 16,
blacks: -14,
whites: 10,
grain: { amount: 12, size: 30, roughness: 40 },
hsl: { hue: [0, 0, 0, 0, 0, 0, 0, 0], sat: [0, 0, 0, 0, 0, 0, 0, 0], lum: [10, 14, 8, -10, 0, -16, 0, 0] },
},
},
{
id: 'bw-soft',
name: 'B&W Soft',
group: 'Black & White',
edits: {
bw: true,
bwFilter: 'none',
bwFilterAmount: 100,
contrast: -4,
shadows: 16,
clarity: -6,
grain: { amount: 18, size: 32, roughness: 30 },
curve: { rgb: [{ x: 0, y: 0.05 }, { x: 0.5, y: 0.52 }, { x: 1, y: 0.96 }], red: identity(), green: identity(), blue: identity() },
},
},
{
id: 'neon-night',
name: 'Neon Night',
group: 'Cinematic',
edits: {
temp: -14,
contrast: 20,
blacks: -22,
vibrance: 30,
clarity: 10,
grading: { shadows: { h: 262, s: 30 }, highlights: { h: 192, s: 22 }, balance: -6 },
},
},
{
id: 'vintage-print',
name: 'Vintage Print',
group: 'Film',
edits: {
temp: 16,
contrast: -6,
saturation: -20,
grain: { amount: 28, size: 34, roughness: 45 },
vignette: { amount: -30, midpoint: 45, feather: 60 },
grading: { shadows: { h: 38, s: 18 }, highlights: { h: 46, s: 10 }, balance: 0 },
},
},
{
id: 'clean-minimal',
name: 'Clean Minimal',
group: 'Essentials',
edits: { exposure: 0.08, contrast: 6, clarity: 4, vibrance: 8, highlights: -12, shadows: 6 },
},
...FILM_PRESETS,
];
/* ------------------------------------------------------------- film variants */
export type FilmVariant = 'base' | 'push' | 'pull' | 'warm' | 'cool';
export const FILM_VARIANTS: { id: FilmVariant; label: string; hint: string }[] = [
{ id: 'base', label: 'Stock', hint: 'The film as normally exposed and developed' },
{ id: 'push', label: 'Push +1', hint: 'One stop over-developed: brighter, punchier, grainier' },
{ id: 'pull', label: 'Pull −1', hint: 'One stop under-developed: darker, flatter, finer grain' },
{ id: 'warm', label: 'Warm split', hint: 'Split grade with warm highlights and cool shadows' },
{ id: 'cool', label: 'Cool split', hint: 'Split grade with cool highlights and warm shadows' },
];
const FILM_GROUPS = new Set([
'Kodak',
'Fujifilm',
'Ilford',
'Agfa',
'CineStill',
'Lomography',
'Polaroid & Instant',
'Rollei & Bergger',
]);
/** Derives a push/pull or split-grade version of a film stock preset. */
export function applyFilmVariant(preset: Preset, variant: FilmVariant): Preset {
if (variant === 'base' || !FILM_GROUPS.has(preset.group)) return preset;
const e = preset.edits;
const grading = e.grading ?? { shadows: { h: 210, s: 0 }, highlights: { h: 45, s: 0 }, balance: 0 };
const grain = e.grain ?? { amount: 0, size: 25, roughness: 50 };
const next: Preset['edits'] = { ...e };
let label = '';
if (variant === 'push') {
label = 'Push +1';
next.exposure = (e.exposure ?? 0) + 1;
next.contrast = (e.contrast ?? 0) + 8;
next.highlights = (e.highlights ?? 0) - 6;
next.blacks = (e.blacks ?? 0) - 6;
next.vibrance = (e.vibrance ?? 0) + 4;
next.grain = { ...grain, amount: Math.min(100, Math.round(grain.amount * 1.6 + 4)) };
} else if (variant === 'pull') {
label = 'Pull −1';
next.exposure = (e.exposure ?? 0) - 1;
next.contrast = (e.contrast ?? 0) - 10;
next.shadows = (e.shadows ?? 0) + 4;
next.blacks = (e.blacks ?? 0) + 2;
next.grain = { ...grain, amount: Math.round(grain.amount * 0.65) };
} else if (variant === 'warm') {
label = 'Warm split';
next.grading = {
highlights: { h: 42, s: Math.max(14, grading.highlights.s) },
shadows: { h: 214, s: Math.max(10, grading.shadows.s) },
balance: 12,
};
} else {
label = 'Cool split';
next.grading = {
highlights: { h: 196, s: Math.max(12, grading.highlights.s) },
shadows: { h: 34, s: Math.max(8, grading.shadows.s) },
balance: -10,
};
}
return { ...preset, id: `${preset.id}::${variant}`, name: `${preset.name} · ${label}`, edits: next };
}
export const PRESET_GROUPS = [
'Essentials',
'Portrait',
'Outdoor',
'Warm',
'Cinematic',
'Film',
'Black & White',
'Kodak',
'Fujifilm',
'Ilford',
'Agfa',
'CineStill',
'Lomography',
'Polaroid & Instant',
'Rollei & Bergger',
];