Jimp can be used anywhere that javascript is supported. It can be used in the browser, in Node.js, or in a web worker.
Jimp comes with a pre-bundled browser version.
To use it simply import jimp instead.
How to use in the browser
Usage
There are a few main ways to use Jimp in the browser.
With hosted file
You can initialize a Jimp instance from a URL or a file path.
With uploaded files
Or you can use Jimp with an ArrayBuffer.
Here we take a user’s uploaded image and modify it to greyscale.
Using Canvas
You can also use Jimp with a canvas.
Using Fonts
Jimp supports loading fonts from a URL or a file path.
You must host the fonts and will not be able to use the ones included in the node version of Jimp.
PRs welcome!
Web Workers
Jimp can be slow and you don’t want that running on the main thread.
Workers can make this experience a lot better.
First define a worker.
This is where you should import jimp and do your image transformations.