From a43a3369659194ad5ce5aacdcd2ed440f0a437a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Mon, 17 Nov 2025 12:49:41 +0100 Subject: [PATCH] fix: pass format as first argument to image.write() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The correct ImageMagick WASM API is: image.write(format, callback) Where the format is passed as the first argument and the callback receives the encoded data. This should produce valid WebP with correct RIFF headers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- lib/converters/imagemagickService.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/converters/imagemagickService.ts b/lib/converters/imagemagickService.ts index 0462199..4e5d5dc 100644 --- a/lib/converters/imagemagickService.ts +++ b/lib/converters/imagemagickService.ts @@ -39,9 +39,6 @@ export async function convertWithImageMagick( let result: Uint8Array | undefined; await ImageMagick.read(inputData, (image) => { - // Set output format - image.format = outputFormatEnum; - // Apply quality setting if specified if (options.imageQuality !== undefined) { image.quality = options.imageQuality; @@ -68,8 +65,8 @@ export async function convertWithImageMagick( if (onProgress) onProgress(70); - // Write the image data in the specified format - image.write((data) => { + // Write the image data with format + image.write(outputFormatEnum, (data) => { result = data; });