Skip to content

Instantly share code, notes, and snippets.

@yoya
Last active December 16, 2022 05:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoya/8e1fbd6f13d27e1c89e88b5dbdac8195 to your computer and use it in GitHub Desktop.
Save yoya/8e1fbd6f13d27e1c89e88b5dbdac8195 to your computer and use it in GitHub Desktop.
sample for magick-asm without build tool.
<html>
<body>
<canvas id="canvasId"> </canvas>
<script type="module">
import { ImageMagick, initializeImageMagick } from './node_modules/@imagemagick/magick-wasm/dist/index.mjs';
const canvas = document.getElementById('canvasId')
initializeImageMagick().then(() => {
ImageMagick.read("logo:", (image) => image.writeToCanvas(canvas));
ImageMagick.readFromCanvas(canvas, (image) => {
const degrees = 90
image.rotate(degrees)
image.writeToCanvas(canvas)
})
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment