How to crop rectangle from image in android

I use this example to crop an image that was selected from the gallery, but the problem is that these are only cropping squares. Is it possible to crop rectangles, not just squares? In this example, if I move on one side, the adjacent side moves forward, keeping it square.

Thank.

+5
source share
2 answers

I found that you can crop rectangles using the built-in Android crop processor (com.android.camera.action.CROP). To crop the rectangles, you need to remove the following parameters from the example that I passed before:

intent.putExtra("outputX", 200); //Set this to define the max size of the output bitmap
intent.putExtra("outputY", 200); //Set this to define the max size of the output bitmap
intent.putExtra("aspectX", 1); //Set this to define the X aspect ratio of the shape
intent.putExtra("aspectY", 1); //Set this to define the Y aspect ratio of the shape

aspectX aspectY . , .

+12

-, , , Android (com.android.camera.action.CROP).

. , SDK ( GIT).

Q & A, Stack Overflow. , .

+3

All Articles