Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lumeland/imagemagick-deno

Deno port of the WASM library for ImageMagick
https://github.com/lumeland/imagemagick-deno

deno imagemagick

Last synced: 2 months ago
JSON representation

Deno port of the WASM library for ImageMagick

Awesome Lists containing this project

README

        

# ImageMagick for Deno

Scripts to transform the source code of
[magick-wasm](https://github.com/dlemstra/magick-wasm) for Deno compatibility.

```sh
sh run.sh
```

To import ImageMagick into your Deno project:

```ts
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

- Transform the code: `sh run.sh`.
- Test it: `deno run -A --no-check test/test.ts`.