Crop Tools
Tools for calculating image crops.

import { calculateCrop, scaleCrop } from 'crop-tools';
const crop = calculateCrop({
imageDimensions: {
width: 1280,
height: 720,
},
cropDimensions: {
width: 300,
height: 400,
},
});
const cropUsingPOI = calculateCrop({
imageDimensions: {
width: 1280,
height: 720,
},
cropDimensions: {
width: 300,
height: 400,
},
poi: {
x: 25,
y: 25,
},
});
const scaledCrop = scaleCrop({
imageDimensions: {
original: {
width: 1280,
height: 720,
},
current: {
width: 320,
height: 180,
},
},
crop,
});