How do I set the starting position of a crop using imgscalr?
2 answers
//center
Scalr.crop(image,
(image.getWidth() - width) / 2, (image.getHeight() - height) / 2,
width, height);
//top left:
Scalr.crop(image, width, height);
//top right:
Scalr.crop(image,
image.getWidth() - width, 0,
width, height);
//bottom left:
Scalr.crop(image,
0, image.getHeight() - height,
width, height);
//bottom right:
Scalr.crop(image,
image.getWidth() - width, image.getHeight() - height,
width, height);
0
source to share