diff --git a/docs/Luminary-User-Guide.pdf b/docs/Luminary-User-Guide.pdf
index 56bea09..4e379c6 100644
Binary files a/docs/Luminary-User-Guide.pdf and b/docs/Luminary-User-Guide.pdf differ
diff --git a/docs/user-guide/guide.html b/docs/user-guide/guide.html
index 6a15b48..5930aa3 100644
--- a/docs/user-guide/guide.html
+++ b/docs/user-guide/guide.html
@@ -224,7 +224,7 @@
@@ -306,7 +306,7 @@
| Browser | A current Chromium (Chrome, Edge), Firefox or Safari with WebGL 2. Hardware acceleration is strongly recommended: previews, thumbnails and exports all render on the GPU. |
| Display | 1280 × 800 minimum. The layout is built for a laptop and expands to fill a desktop screen. |
- | Server (optional) | Node 22.5+ or Docker, for raw decoding, shared storage, accounts and proofing links. JPEG/PNG/TIFF work without it. |
+ | Server (optional) | Node 22.5+ or Docker, for raw and TIFF decoding, shared storage, accounts and proofing links. JPEG, PNG, WebP and AVIF work without it. |
| Windows app (optional) | Windows 10 or 11, 64-bit. Nothing else: Node, .NET and the VC++ runtime are bundled or not needed. |
@@ -452,7 +452,8 @@
| Type | Behaviour |
- | JPEG, PNG, WebP, AVIF, TIFF | Decoded in the browser. EXIF camera, lens, ISO, aperture, shutter and focal length are read when present. |
+ | JPEG, PNG, WebP, AVIF | Decoded in the browser. EXIF camera, lens, ISO, aperture, shutter and focal length are read when present. |
+ | TIFF (.tif, .tiff) | Decoded on the server into an editable JPEG proxy, because browsers have no TIFF decoder. The original TIFF is stored untouched and the full-resolution proxy drives the editor and export. |
| Camera raw — CR2, CR3, NEF, ARW, ORF, RW2, RAF, DNG, PEF, SRW, 3FR and 20 more | Sent to the server, demosaiced with LibRaw, stored as the original plus an editable JPEG proxy and a 16-bit sidecar. |
@@ -1176,6 +1177,7 @@
No plugin ecosystem. Edits live in the catalogue record and XMP sidecars, not in third-party plugins.
Colour management is per export. Choose sRGB, Display P3 or Adobe RGB in the export dialog; the soft-proof panel handles printer gamut.
Browser storage is finite. Large raw catalogues belong on the server; the browser copy is a working cache.
+
TIFF is edited through a proxy. TIFF has no browser decoder, so the server writes a JPEG proxy capped at RAW_EDGE (6000 px by default); the original TIFF is stored unchanged for fidelity and re-proxying.
Unsigned Windows build. SmartScreen warns on first run; sign the executable if you distribute it widely.
@@ -1199,7 +1201,7 @@
| PNG (.png) | Browser |
| WebP (.webp) | Browser |
| AVIF (.avif) | Browser |
-
| TIFF (.tif, .tiff) | Browser |
+
| TIFF (.tif, .tiff) | Server (sharp JPEG proxy; browsers cannot decode TIFF) |
| Camera raw: CR2, CR3, CRW, NEF, NRW, ARW, SRF, SR2, ORF, RW2, RWL, RAF, PEF, DNG, SRW, 3FR, FFF, IIQ, X3F, ERF, K25, KDC, DCR, MOS, MRW, MEF | Server (LibRaw) |
diff --git a/public/luminary-user-guide.pdf b/public/luminary-user-guide.pdf
index 56bea09..4e379c6 100644
Binary files a/public/luminary-user-guide.pdf and b/public/luminary-user-guide.pdf differ
diff --git a/server/index.mjs b/server/index.mjs
index 135ba97..5ff7a26 100644
--- a/server/index.mjs
+++ b/server/index.mjs
@@ -80,7 +80,7 @@ import {
writeThumb16,
} from './storage.mjs';
import { previewRebuildTargets, startPreviewRebuild } from './previewRebuild.mjs';
-import { decodeRaw, isRawName, rawSupport } from './raw.mjs';
+import { decodeRaw, decodeStill, isRawName, isStillName, rawSupport } from './raw.mjs';
import {
bridgeConfigured,
bridgeForEvent,
@@ -2080,7 +2080,10 @@ route('POST', '/api/photos/:id/original', async ({ req, res, params }) => {
const drop = url.searchParams.get('drop') === '1';
const mime = normalizePhotoMime(url.searchParams.get('mime') || '', name);
const ext = (name.split('.').pop() || 'bin').toLowerCase();
- const raw = isRawName(name) || drop;
+ // TIFF is not a raw container, but browsers cannot decode it either. It takes
+ // the same upload path and is turned into a JPEG proxy here with sharp.
+ const still = isStillName(name);
+ const raw = isRawName(name) || drop || still;
// New ids are part of the normal import flow: the client uploads bytes first
// and PUTs the record afterwards. Until that row exists the bytes are charged
@@ -2148,7 +2151,7 @@ route('POST', '/api/photos/:id/original', async ({ req, res, params }) => {
if (raw) {
try {
const data = await fsp.readFile(target);
- const decoded = await decodeRaw(data);
+ const decoded = still ? await decodeStill(data) : await decodeRaw(data);
await writePreview(params.id, decoded.jpeg, decoded.ext);
if (decoded.preview16) {
await writePreview16(params.id, decoded.preview16.data);
@@ -2161,7 +2164,8 @@ route('POST', '/api/photos/:id/original', async ({ req, res, params }) => {
}
const info = await jpegInfo(decoded.jpeg);
return json(res, 201, {
- raw: true,
+ raw: isRawName(name) || drop,
+ serverDecoded: still,
engine: decoded.engine,
width: info?.width || decoded.width,
height: info?.height || decoded.height,
diff --git a/server/raw.mjs b/server/raw.mjs
index 9da351f..dc338e7 100644
--- a/server/raw.mjs
+++ b/server/raw.mjs
@@ -28,6 +28,26 @@ export function isRawName(name = '') {
return RAW_EXTENSIONS.has(ext);
}
+/**
+ * Standard images that browsers cannot decode. TIFF takes the raw upload path
+ * (store the original, serve a JPEG proxy) but is decoded by sharp, not LibRaw.
+ */
+export const SERVER_IMAGE_EXTENSIONS = new Set(['tif', 'tiff']);
+
+export function isStillName(name = '') {
+ const ext = name.split('.').pop()?.toLowerCase() ?? '';
+ return SERVER_IMAGE_EXTENSIONS.has(ext);
+}
+
+/** Rejects instead of waiting forever when a decoder wedges on one file. */
+function withTimeout(promise, ms, message) {
+ let timer;
+ const guard = new Promise((_, reject) => {
+ timer = setTimeout(() => reject(new Error(message)), ms);
+ });
+ return Promise.race([promise, guard]).finally(() => clearTimeout(timer));
+}
+
/** True when the buffer starts with a container signature LibRaw can open. */
export function looksLikeRaw(buffer) {
if (!buffer || buffer.length < 64) return false;
@@ -45,6 +65,19 @@ export function looksLikeRaw(buffer) {
let engineState = 'unloaded';
+export async function decodeStill(buffer) {
+ const proxy = await toJpegProxy(buffer, RAW_PREVIEW_EDGE);
+ if (!proxy) throw new Error('Could not decode this image');
+ const size = await jpegInfo(proxy.data);
+ return {
+ jpeg: proxy.data,
+ width: size?.width || proxy.width,
+ height: size?.height || proxy.height,
+ engine: 'sharp',
+ ext: proxy.ext,
+ };
+}
+
export async function rawEngine() {
if (engineState === 'unloaded') {
try {
@@ -187,10 +220,14 @@ export function extractEmbeddedJpeg(buffer) {
async function embeddedPreview(buffer) {
if ((await rawEngine()) === 'ready') {
try {
- const thumb = await rawPool.use(async (lib) => {
- await lib.open(Buffer.from(buffer), { useCameraWb: true });
- return lib.thumbnailData();
- });
+ const thumb = await withTimeout(
+ rawPool.use(async (lib) => {
+ await lib.open(Buffer.from(buffer), { useCameraWb: true });
+ return lib.thumbnailData();
+ }),
+ 12000,
+ 'LibRaw preview timed out',
+ );
if (thumb?.data && thumb.format === 'jpeg' && thumb.data.length > 4096) {
return Buffer.from(thumb.data);
}
@@ -209,10 +246,10 @@ export async function decodeRaw(buffer) {
let librawError = null;
if (looksLikeRaw(buffer)) {
try {
- let frame = await demosaic(buffer, true);
+ let frame = await withTimeout(demosaic(buffer, true), 45000, 'LibRaw timed out on this file');
// No usable matrix (an odd body or older engine): decode the familiar sRGB
// way instead of shipping camera samples nobody can convert.
- if (!frame.rgbCam || !frame.rgb16) frame = await demosaic(buffer, false);
+ if (!frame.rgbCam || !frame.rgb16) frame = await withTimeout(demosaic(buffer, false), 45000, 'LibRaw timed out on this file');
const { width, height, rgbCam } = frame;
// Both buffers are rewritten in place: `rgb` becomes the sRGB proxy and
// `rgb16` the camera-native sidecar, sharing one white point.
diff --git a/src/components/Panels.tsx b/src/components/Panels.tsx
index 0504aa7..f061fed 100644
--- a/src/components/Panels.tsx
+++ b/src/components/Panels.tsx
@@ -1481,7 +1481,13 @@ export function NavigatorPanel({
{photo.name}
- {photo.raw ? (photo.decode === 'embedded' ? 'Raw · camera preview' : 'Raw · demosaiced') : 'JPEG/PNG'}{' '}
+ {photo.raw
+ ? photo.decode === 'embedded'
+ ? 'Raw · camera preview'
+ : 'Raw · demosaiced'
+ : photo.decode === 'sharp'
+ ? 'TIFF · server JPEG'
+ : 'JPEG/PNG'}{' '}
· {photo.width}×{photo.height}
diff --git a/src/lib/api.ts b/src/lib/api.ts
index 62bef57..bc99958 100644
--- a/src/lib/api.ts
+++ b/src/lib/api.ts
@@ -23,7 +23,7 @@ export interface SessionUser {
export interface UploadResult {
raw: boolean;
- engine?: 'libraw' | 'embedded';
+ engine?: 'libraw' | 'embedded' | 'sharp';
width?: number;
height?: number;
mime?: string;
@@ -153,7 +153,7 @@ export function reprocessRawPhoto(
): Promise<{
width: number;
height: number;
- engine?: 'libraw' | 'embedded';
+ engine?: 'libraw' | 'embedded' | 'sharp';
note?: string | null;
previewVersion?: number;
previewUrl?: string;
diff --git a/src/lib/images.ts b/src/lib/images.ts
index 78c59f0..8692600 100644
--- a/src/lib/images.ts
+++ b/src/lib/images.ts
@@ -7,7 +7,11 @@ const cache = new Map