Package Exports
- @jimp/plugin-crop
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@jimp/plugin-crop) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Crop
Crops the image at a given point to a give size
- @param {number} x the x coordinate to crop form
- @param {number} y the y coordinate to crop form
- @param w the width of the crop region
- @param h the height of the crop region
- @param {function(Error, Jimp)} cb (optional) a callback for when complete
import jimp from 'jimp';
async function main() {
const image = await jimp.read('test/image.png');
image.crop(150, 150);
}
main();AutoCrop
AutoCrop same color borders from this image
_ @param {number} tolerance (optional): a percent value of tolerance for pixels color difference (default: 0.0002%) _ @param {boolean} cropOnlyFrames (optional): flag to crop only real frames: all 4 sides of the image must have some border (default: true)
import jimp from 'jimp';
async function main() {
const image = await jimp.read('test/image.png');
image.autocrop();
}
main();