Custom Jimp
If you don’t want to use all the default plugins included in the jimp
package, you can create a custom Jimp.
Creating a custom Jimp
To create a custom Jimp, you can use the create
function from the jimp
package.
import { promises as fs } from "fs";
import { createJimp } from "@jimp/core";import png from "@jimp/js-png";import * as resize from "@jimp/plugin-resize";
const MyJimp = createJimp({ plugins: [resize.methods], formats: [png],});
const image = await MyJimp.read("test/image.png");
image.resize({ width: 100 });
await image.write("test/output.png");