I have tried to use imgscalr library with the following crop method:
Scalr.crop(image, height, width);
But it always crops starting at the left upper corner of the image. Can I tweak this behavior to start in the right bottom corner or center?
I have tried to use imgscalr library with the following crop method:
Scalr.crop(image, height, width);
But it always crops starting at the left upper corner of the image. Can I tweak this behavior to start in the right bottom corner or center?
                        
                            
                        
                        
                            On
                            
                            
                                                    
                    
                //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);
                        
Definitely - just use the other
cropoperation that takes x,y,width,height arguments.