feat: add support for JXL, Camera RAW, ICO, TGA, PSD, EXR, HDR image formats

Extends the platform to handle 7 new image format families alongside
the existing AVIF support gap-fill. Uses the established HEIC decoder
pattern (CLI decode → PNG → Sharp) for formats Sharp can't handle
natively: Camera RAW via dcraw_emu/LibRaw, PSD/TGA/EXR/HDR via
ImageMagick. JXL and ICO are Sharp-native. Adds server-side preview
for non-browser-displayable formats and JXL as a new convert output
target. All 27 validateImageBuffer callers updated with filename for
extension-based format detection.
This commit is contained in:
ashim-hq
2026-04-21 09:59:57 +08:00
parent e94ac945bb
commit 2aadb66031
39 changed files with 583 additions and 43 deletions
+10 -2
View File
@@ -1,10 +1,18 @@
import { formatHeaders } from "@/lib/api";
const HEIF_EXTENSIONS = new Set(["heic", "heif", "hif"]);
const SERVER_PREVIEW_EXTENSIONS = new Set([
"heic", "heif", "hif", // HEIF
"jxl", // JPEG XL (Chrome dropped support)
"dng", "cr2", "nef", "arw", "orf", "rw2", // Camera RAW
"tga", // Targa
"psd", // Photoshop
"exr", // OpenEXR
"hdr", // Radiance HDR
]);
export function needsServerPreview(file: File): boolean {
const ext = file.name.split(".").pop()?.toLowerCase() ?? "";
return HEIF_EXTENSIONS.has(ext);
return SERVER_PREVIEW_EXTENSIONS.has(ext);
}
export async function fetchDecodedPreview(file: File): Promise<string | null> {