Using magick-wasm in the browser without node.js? #112
Unanswered
UnluckyForSome
asked this question in
Q&A
Replies: 3 comments 7 replies
-
It looks like that import alias doesn't work? I had to use this instead: <html>
<head>
<meta charset="UTF-8" />
<title>Magick-WASM Example</title>
<script type="module">
//import the library to talk to imagemagick
import * as foo from '/index.umd.js';
console.log(window['magick-wasm']);
</script>
</head>
<body></body>
</html> |
Beta Was this translation helpful? Give feedback.
1 reply
-
The const magickModule = window['magick-wasm'];
await magickModule.initializeImageMagick();
const magick = magickModule.Magick;
console.log(magick.delegates); |
Beta Was this translation helpful? Give feedback.
5 replies
-
Has anyone managed to import with a bundler (vite, also using I tried: import magickWasm from '@imagemagick/magick-wasm/magick.wasm?init'
// import magickWasm from '@imagemagick/magick-wasm/magick.wasm?raw'
initializeImageMagick(magickWasm)... And some variations but everything I've tried causes exceptions |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
I'm trying to import magick.wasm to use within my own javascript, without using node.js - but it doesn't seem to be working.
Downloading the library gives me 4 files:
index.d.ts
,index.mjs
,index.umd.js
andmagick.wasm
I've tried both using
index.umd.js
and a "browserified" bundle ofindex.mjs
andindex.umd.js
but so far no luckI have my HTML like so to see if the Magick functions are being imported:
...but the array is returning empty. I must be doing something wrong. Is there any way to do this without using npm/node.js?
Beta Was this translation helpful? Give feedback.
All reactions