Skip to main content
Deno 2 is finally here 🎉️
Learn more

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

const fs = require('fs').promises;
const {Image} = require('imagescript');

(async () => {
    const image = await Image.decode(await fs.readFile('./photo.png'));
    const overlay = await Image.decode(await fs.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 fs.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.