mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-22 21:58:23 +00:00
- Add centralized RAW file extension set and detection helper for 23 common camera RAW formats - Update getProxyType and EXTENSION_MIME_TYPES to route RAW formats into the image pipeline - Add exiftool-vendored runtime dependency and mark as external in build-npm script - Implement embedded JPEG extraction to temporary file with priority JpgFromRaw2 -> JpgFromRaw -> PreviewImage - Read and apply EXIF orientation from RAW container to prevent rotation/mirroring issues - Integrate into TranscodeService.getImageInfo and transcodeImage with proper temporary file cleanup - Add hasUsablePreview guard in transcodeImageWorkflow to gracefully handle RAW files without embedded previews - Add unit, service, workflow, and E2E tests for RAW processing
38 lines
719 B
TypeScript
38 lines
719 B
TypeScript
/**
|
|
* Centralized set of recognized camera RAW file extensions.
|
|
* Used only for routing files into the ExifTool extraction path.
|
|
*/
|
|
const RAW_EXTENSIONS: ReadonlySet<string> = new Set([
|
|
'.3fr',
|
|
'.arw',
|
|
'.cr2',
|
|
'.cr3',
|
|
'.crw',
|
|
'.dcr',
|
|
'.dng',
|
|
'.erf',
|
|
'.fff',
|
|
'.iiq',
|
|
'.kdc',
|
|
'.nef',
|
|
'.nrw',
|
|
'.orf',
|
|
'.pef',
|
|
'.raf',
|
|
'.raw',
|
|
'.rw2',
|
|
'.rwl',
|
|
'.sr2',
|
|
'.srf',
|
|
'.srw',
|
|
'.x3f',
|
|
])
|
|
|
|
/** Check whether a filename has a recognized camera RAW extension. */
|
|
export function isRawImage(filename: string): boolean {
|
|
const dotIndex = filename.lastIndexOf('.')
|
|
if (dotIndex === -1) return false
|
|
const ext = filename.slice(dotIndex).toLowerCase()
|
|
return RAW_EXTENSIONS.has(ext)
|
|
}
|