mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat: add HEIC/HEIF format support for input and output
Add bidirectional HEIC support using system libheif CLI tools (heif-enc/heif-dec) for HEVC encoding/decoding, since Sharp's bundled libheif only supports AV1. - HEIC input: all tools now accept iPhone HEIC photos via heif-dec pre-processing - HEIC output: convert tool produces true HEIC (HEVC) via heif-enc - Docker: adds libheif-examples package for heif-enc/heif-dec CLI tools - Tests: full conversion matrix (7x7), unit tests, and Playwright e2e tests - Docs: updated OpenAPI spec, image-engine docs, getting-started, llms-full.txt
This commit is contained in:
@@ -15,6 +15,7 @@ import { env } from "../config.js";
|
||||
import { autoOrient } from "../lib/auto-orient.js";
|
||||
import { validateImageBuffer } from "../lib/file-validation.js";
|
||||
import { sanitizeFilename } from "../lib/filename.js";
|
||||
import { decodeHeic } from "../lib/heic-converter.js";
|
||||
import { type JobProgress, updateJobProgress } from "./progress.js";
|
||||
import { getToolConfig } from "./tool-factory.js";
|
||||
|
||||
@@ -187,8 +188,12 @@ export async function registerBatchRoutes(app: FastifyInstance): Promise<void> {
|
||||
}
|
||||
|
||||
try {
|
||||
const orientedBuffer = await autoOrient(file.buffer);
|
||||
const result = await toolConfig.process(orientedBuffer, settings, file.filename);
|
||||
let processBuffer = file.buffer;
|
||||
if (validation.format === "heif") {
|
||||
processBuffer = await decodeHeic(processBuffer);
|
||||
}
|
||||
processBuffer = await autoOrient(processBuffer);
|
||||
const result = await toolConfig.process(processBuffer, settings, file.filename);
|
||||
|
||||
const zipFilename = getUniqueName(result.filename);
|
||||
archive.append(result.buffer, { name: zipFilename });
|
||||
|
||||
Reference in New Issue
Block a user