How to crop an image

How to crop an image

         Image cropping supports two types of possible methods: either crop by defining new image boundaries by shifts from the sides of the image, for example, 10 px for left, right top and bottom shifts or to indicate a rectangle area to use for the image cropping.

Crop by shifts

         Please see the example below which use the Crop method of the Java class RasterImage to crop the image by shifts on 10px from each side:

Crop by rectangle

         This example shows how to create a rectangle area with a sides length of 20 px and then Crop by rectangle the selected area from the original picture: