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
+5 -1
View File
@@ -2182,6 +2182,10 @@ route('POST', '/api/photos/:id/original', async ({ req, res, params }) => {
const url = new URL(req.url ?? '/', 'http://localhost');
const name = url.searchParams.get('name') || 'upload';
const drop = url.searchParams.get('drop') === '1';
// The import dialog can ask for an 8-bit import; anything else keeps the
// LUMINARY_16BIT setting. Only `sidecar=0` is meaningful, so the default path
// behaves exactly as before.
const sidecar = url.searchParams.get('sidecar') !== '0';
const mime = normalizePhotoMime(url.searchParams.get('mime') || '', name);
const ext = (name.split('.').pop() || 'bin').toLowerCase();
// TIFF is not a raw container, but browsers cannot decode it either. It takes
@@ -2276,7 +2280,7 @@ route('POST', '/api/photos/:id/original', async ({ req, res, params }) => {
if (raw) {
try {
const data = await fsp.readFile(target);
const decoded = still ? await decodeStill(data) : await decodeRaw(data);
const decoded = still ? await decodeStill(data) : await decodeRaw(data, { sidecar });
await writePreview(params.id, decoded.jpeg, decoded.ext);
if (decoded.preview16) {
await writePreview16(params.id, decoded.preview16.data);