Import TIFF through the server and survive a wedged raw decoder
Browsers have no TIFF decoder, so TIFF import failed at createImageBitmap and the develop canvas asked for the undecodable original. TIFF now takes the raw proxy path (original stored, sharp writes the JPEG proxy) and the editor reads that proxy. LibRaw demosaic and preview calls are bounded so one bad file falls back to the embedded preview instead of hanging.
This commit is contained in:
+7
-4
@@ -4,7 +4,7 @@ import type { PhotoMeta, PhotoRecord } from '../types';
|
||||
import { putAsset, putPhoto } from './db';
|
||||
import { defaultEdits, normalizePhoto } from './edits';
|
||||
import { defaultForMeta, loadCameraLensDefaults, type CameraLensDefault } from './lensDefaults';
|
||||
import { isRawFile, RAW_EXTENSIONS } from './raw';
|
||||
import { isRawFile, isTiffFile, RAW_EXTENSIONS } from './raw';
|
||||
|
||||
export interface ImportProgress {
|
||||
done: number;
|
||||
@@ -125,6 +125,8 @@ async function importRaw(
|
||||
keywords: string[],
|
||||
cloud: CloudImport,
|
||||
defaults: CameraLensDefault[],
|
||||
/** TIFF goes through the same proxy path but is not a raw container. */
|
||||
raw = true,
|
||||
): Promise<PhotoRecord> {
|
||||
const id = uid();
|
||||
const upload = await cloud.uploadOriginal(id, file, file.name);
|
||||
@@ -158,7 +160,7 @@ async function importRaw(
|
||||
keywords,
|
||||
edits,
|
||||
history: [{ label: 'Import', ts: Date.now(), edits }],
|
||||
raw: true,
|
||||
raw,
|
||||
decode: upload.engine,
|
||||
previewUrl,
|
||||
});
|
||||
@@ -242,9 +244,10 @@ export async function importFiles(
|
||||
await mapLimit(images, cloud ? IMPORT_CONCURRENCY : 2, async (file, index) => {
|
||||
if (signal?.aborted) return;
|
||||
try {
|
||||
const photo = isRawFile(file)
|
||||
const viaServer = isRawFile(file) || isTiffFile(file);
|
||||
const photo = viaServer
|
||||
? cloud
|
||||
? await importRaw(file, eventId, keywords, cloud, defaults)
|
||||
? await importRaw(file, eventId, keywords, cloud, defaults, isRawFile(file))
|
||||
: (() => {
|
||||
throw new Error('Raw files need the Luminary server. Sign in, then import again.');
|
||||
})()
|
||||
|
||||
Reference in New Issue
Block a user