Skip to main content

ImageScript

zero-dependency JavaScript image manipulation

Discord Server Docs Github


ImageScript is a zero-dependency alternative to common JavaScript bitmap image manipulation tools. It can achieve much more performant results by utilizing lower-level memory access, less memory copying and WebAssembly for compression and encoding.


Example

import {Image} from 'https://deno.land/x/imagescript/mod.ts';

(async () => {
    const image = await Image.decode(await Deno.readFile('./photo.png'));
    const overlay = await Image.decode(await Deno.readFile('./overlay.png'));

    image.crop(228, 20, 152, 171);

    overlay.resize(image.width, Image.RESIZE_AUTO);
    overlay.opacity(0.8, true);
    image.composite(overlay, 0, image.height - overlay.height);

    await Deno.writeFile('./output.png', await image.encode());
})();

Inputs

Photo
Overlay

Output

Output


If you have any additional questions, feel free to join the discord support server.