You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Curious how to initialize the ImageMagick WASM module by fetch-ing the magick.wasm file, then converting that into an UInt8Array, before passing that data into the initializeImageMagick function.
It would appear the initialization function supports the magick.wasm file as an 8-bit array as defined here, but running this in the browser doesn't appear to be working for me.
Here's a rudimentary example of what I mean:
import{initializeImageMagick,}from"@imagemagick/magick-wasm";(async()=>{constwasmLocation=newURL('http://localhost:7000/magick.wasm').href;// basic web server using the `http-server` npm packageconstwasmResponse=awaitfetch(wasmLocation);constwasmBuffer=awaitwasmResponse.arrayBuffer();constwasmBytes=newUint8Array(wasmBuffer);awaitinitializeImageMagick(wasmBytes);})();
Console gives me this error Uncaught (in promise) TypeError: t.startsWith is not a function.
Bundling using esbuild, not sure that's doing anything strange or not.
For what it's worth, passing a URL as the wasm location into initializeImageMagick imports the wasm module fine.
That functionality has not yet been released. This will become available in the next release. If you really need this I can publish a new release sooner?
magick-wasm version
0.0.21
Description
This example is for the browser environment
Curious how to initialize the ImageMagick WASM module by
fetch
-ing themagick.wasm
file, then converting that into anUInt8Array
, before passing that data into theinitializeImageMagick
function.It would appear the initialization function supports the
magick.wasm
file as an 8-bit array as defined here, but running this in the browser doesn't appear to be working for me.Here's a rudimentary example of what I mean:
Console gives me this error
Uncaught (in promise) TypeError: t.startsWith is not a function
.Bundling using
esbuild
, not sure that's doing anything strange or not.For what it's worth, passing a URL as the wasm location into
initializeImageMagick
imports the wasm module fine.AKA
Thanks!
Steps to Reproduce
Example in bug description.
Images
The text was updated successfully, but these errors were encountered: