我尝试使用下面的裁剪方法使用imgscalr库:
Scalr.crop(image, height, width);但它总是从图像的左上角开始进行裁剪。我能把这种行为调整为从右下角或中间开始吗?
发布于 2014-12-09 01:51:37
当然--只需使用接受x,y,宽度,高度参数的另一个x,y,宽度,高度操作即可。
发布于 2017-05-05 09:50:04
//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);https://stackoverflow.com/questions/27365590
复制相似问题