fix: add proper ImageMagick WASM initialization with CDN URL

The initializeImageMagick() function requires a URL argument pointing
to the WASM file. Without it, the library won't properly load and
conversions may fail.

Changes:
- Add initializeImageMagick() call with CDN URL
- Use jsDelivr CDN for magick.wasm file
- Matches the installed package version (0.0.30)

This ensures ImageMagick WASM is properly initialized before performing
image conversions, preventing potential runtime errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-17 12:02:05 +01:00
parent 78394b7e97
commit 9eb66b4fa3

View File

@@ -26,7 +26,11 @@ export async function convertWithImageMagick(
if (onProgress) onProgress(30);
// Import ImageMagick functions
const { ImageMagick } = await import('@imagemagick/magick-wasm');
const { ImageMagick, initializeImageMagick } = await import('@imagemagick/magick-wasm');
// Initialize ImageMagick with WASM URL from CDN
const wasmUrl = 'https://cdn.jsdelivr.net/npm/@imagemagick/magick-wasm@0.0.30/dist/magick.wasm';
await initializeImageMagick(wasmUrl);
if (onProgress) onProgress(40);