Speed up raw imports and add a per-import 16-bit toggle

Import raws four at a time to match the decoder pool, compress the 16-bit
sidecar with RLE on the libuv pool, and demosaic X-Trans files in a single
Markesteijn pass so Fuji imports no longer queue into decode timeouts. The
import dialog now offers 16-bit (default) or 8-bit per import, sent as
`?sidecar=0`, and the camera thumbnail and embedded-preview fallbacks no
longer drop to 8-bit samples or store a 0x0 photo.
This commit is contained in:
2026-12-02 03:25:53 +00:00
parent ea7b5b846c
commit fa0a7e64ef
11 changed files with 464 additions and 101 deletions
+43 -6
View File
@@ -46,6 +46,9 @@ export default function ImportModal({
const [progress, setProgress] = useState<ImportProgress | null>(null);
const [failures, setFailures] = useState<string[]>([]);
const [allowDuplicates, setAllowDuplicates] = useState(false);
// 16-bit is the default an editor would expect, and it is what a raw import
// should keep unless the whole point is a smaller library.
const [sidecar16, setSidecar16] = useState(true);
const [createGallery, setCreateGallery] = useState(immichEnabled);
const [galleryCreated, setGalleryCreated] = useState(false);
const [galleryError, setGalleryError] = useState<string | null>(null);
@@ -128,7 +131,15 @@ export default function ImportModal({
);
}
}
const result = await importFiles(readyFiles, targetId, [], setProgress, cloud ?? null, controller.signal);
const result = await importFiles(
readyFiles,
targetId,
[],
setProgress,
cloud ?? null,
controller.signal,
{ sidecar16 },
);
if (result.photos.length) onImported(result.photos, targetId);
let published = 0;
@@ -347,13 +358,37 @@ export default function ImportModal({
{rawCount > 0 && cloud && (
<div className="banner info">
{local
? 'Raw files are demosaiced by the Luminary local engine (LibRaw) on this PC, a few ' +
'at a time in parallel. Each file usually takes 2–4 seconds, and nothing leaves your computer.'
: 'Raw files are demosaiced by the server (LibRaw), a few at a time in parallel. Each ' +
'file usually takes 2–4 seconds.'}
? 'Raw files are demosaiced by the Luminary local engine (LibRaw) on this PC, four ' +
'at a time; the rest of your selection waits its turn. A 24 MP raw takes a few ' +
'seconds; a 40 MP compressed Fuji file takes closer to twenty. Nothing leaves ' +
'your computer.'
: 'Raw files are demosaiced by the server (LibRaw), four at a time; the rest of your ' +
'selection waits its turn. A 24 MP raw takes a few seconds; a 40 MP compressed ' +
'Fuji file takes closer to twenty.'}
{' '}A file the engine cannot decode still imports from the camera’s own preview.
</div>
)}
{rawCount > 0 && cloud && (
<>
<label className="check-row">
<input
type="checkbox"
checked={sidecar16}
onChange={(e) => setSidecar16(e.target.checked)}
disabled={busy}
/>
Import raws at 16-bit (recommended)
</label>
<p className="muted small">
A 16-bit sidecar keeps every level the decoder read, so recovering shadows and
highlights works from 65,536 steps per channel instead of 256. It costs roughly
25× the JPEG in disk and download. Uncheck to import at 8-bit instead: smaller,
quicker to upload, but graded from the JPEG.
</p>
</>
)}
{progress && (
<div className="progress">
<div className="progress-bar">
@@ -363,7 +398,9 @@ export default function ImportModal({
/>
</div>
<div className="muted small">
{progress.done} / {progress.total} {progress.current ? `· ${progress.current}` : ''}
{progress.done} / {progress.total}
{progress.waiting ? ` · ${progress.waiting} waiting` : ''}
{progress.current ? ` · ${progress.current}` : ''}
</div>
</div>
)}