mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: JXL decode fallback and Playwright remote container support
Add djxl (libjxl-tools) as primary JXL decoder with ImageMagick fallback — fixes JXL format failures on Ubuntu where stock ImageMagick lacks a JXL delegate. Also make Playwright Docker config respect BASE_URL env var for testing against remote containers.
This commit is contained in:
@@ -216,13 +216,23 @@ async function decodeBmp(buffer: Buffer): Promise<Buffer> {
|
||||
}
|
||||
|
||||
async function decodeJxl(buffer: Buffer): Promise<Buffer> {
|
||||
const cmd = await findMagickCmd();
|
||||
const id = randomUUID();
|
||||
const inputPath = join(tmpdir(), `jxl-in-${id}.jxl`);
|
||||
const outputPath = join(tmpdir(), `jxl-out-${id}.png`);
|
||||
|
||||
try {
|
||||
await writeFile(inputPath, buffer);
|
||||
|
||||
// Try djxl first (from libjxl-tools) — works even when ImageMagick
|
||||
// lacks a JXL delegate (common on Ubuntu stock packages).
|
||||
try {
|
||||
await execFileAsync("djxl", [inputPath, outputPath], { timeout: 120_000 });
|
||||
return await readFile(outputPath);
|
||||
} catch {
|
||||
// djxl not available, fall back to ImageMagick
|
||||
}
|
||||
|
||||
const cmd = await findMagickCmd();
|
||||
await execFileAsync(cmd, magickArgs(cmd, [inputPath, `png:${outputPath}`]), {
|
||||
timeout: 120_000,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user