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
+22
View File
@@ -12,6 +12,17 @@ const EXT_TO_MIME: Record<string, string> = {
ico: "image/x-icon",
heif: "image/heif",
heic: "image/heic",
jxl: "image/jxl",
dng: "image/x-adobe-dng",
cr2: "image/x-canon-cr2",
nef: "image/x-nikon-nef",
arw: "image/x-sony-arw",
orf: "image/x-olympus-orf",
rw2: "image/x-panasonic-rw2",
tga: "image/x-tga",
psd: "image/vnd.adobe.photoshop",
exr: "image/x-exr",
hdr: "image/vnd.radiance",
};
const MIME_TO_EXT: Record<string, string> = {
@@ -26,6 +37,17 @@ const MIME_TO_EXT: Record<string, string> = {
"image/x-icon": "ico",
"image/heif": "heif",
"image/heic": "heic",
"image/jxl": "jxl",
"image/x-adobe-dng": "dng",
"image/x-canon-cr2": "cr2",
"image/x-nikon-nef": "nef",
"image/x-sony-arw": "arw",
"image/x-olympus-orf": "orf",
"image/x-panasonic-rw2": "rw2",
"image/x-tga": "tga",
"image/vnd.adobe.photoshop": "psd",
"image/x-exr": "exr",
"image/vnd.radiance": "hdr",
};
/**