lumeland / imagemagick-deno

Deno port of the WASM library for ImageMagick
https://deno.land/x/imagemagick_deno
Apache License 2.0
44 stars 3 forks source link
deno imagemagick

ImageMagick for Deno

Scripts to transform the source code of magick-wasm for Deno compatibility.

sh run.sh

To import ImageMagick into your Deno project:

import {
  ImageMagick,
  IMagickImage,
  initialize,
  MagickFormat,
} from "https://deno.land/x/imagemagick_deno/mod.ts";

await initialize(); // make sure to initialize first!

const data: Uint8Array = await Deno.readFile("image.jpg");

await ImageMagick.read(data, async (img: IMagickImage) => {
  img.resize(200, 100);
  img.blur(20, 6);

  await img.write(
    MagickFormat.Jpeg,
    (data: Uint8Array) => Deno.writeFile("image-blur.jpg", data),
  );
});

Build