Files
oma-memorial/src/lib/heic.ts
T
denshooter 31dff10636 Use heic-convert for HEIC-to-JPEG conversion
Sharp's prebuilt libvips lacks HEIF codec support. Replace with
heic-convert (pure JS decoder) for reliable HEIC conversion on all
platforms. Existing HEIC files on disk will be converted on-the-fly
when served via /api/files.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-22 02:01:04 +01:00

16 lines
416 B
TypeScript

// @ts-expect-error no type declarations available
import heicConvert from 'heic-convert'
/**
* Convert HEIC/HEIF buffer to JPEG.
* Uses heic-convert (pure JS) since sharp's prebuilt libvips lacks HEIF support.
*/
export async function convertHeicToJpeg(buffer: Buffer): Promise<Buffer> {
const result = await heicConvert({
buffer,
format: 'JPEG',
quality: 0.9,
})
return Buffer.from(result)
}