Crop tool allows cropping image or canvas to one of the preset ratios or a custom ratio.
var pixie = new Pixie({
onLoad: function() {
pixie.tools.crop.apply({width: 100, height: 100, left: 0, top: 50});
}
});
To add custom crop ratios, pass them using the items
option. Ratio previews in pixie interface will be generated automatically based on ratios given.
If replaceDefaultPresets
is set to true
, all default ratios are removed. If it is set to false
, your additional ratios are appended.
var pixie = new Pixie({
tools: {
crop: {
replaceDefaultPresets: false,
presets: [
{ratio: '3:2', name: '3:2'},
{ratio: '5:3', name: '5:3'},
{ratio: '4:3', name: '4:3'},
]
}
}
})
Crop canvas to specified dimensions.
apply(box: {left: number; top: number; width: number; height: number}): void