i'm using this example to crop an image that was selected from the gallery but the problem is that example only crop squares. Would it be possible to crop rectangles instead of only squares? In that example if I move one side the adjacent side moves along, keeping it a square selection.
Thanks.
i found that's possible to crop rectangles using the built-in Android cropping handler.(com.android.camera.action.CROP). To crop rectangles you need to remove the following parameters of 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
Setting the aspectX and aspectY will force the android to move both sides of the shape when you move one of them. Comment those lines and you'll be free to move the shape.
Cropping to anything other than a square shape is not possible using the built-in Android cropping handling (com.android.camera.action.CROP).
You'd have to build your own cropping activity from scratch. You might want to base your own implementation on the implementation from the SDK (requires GIT).
Discussing that complex task into detail is out of scope for a simple answer on a Q&A site like Stack Overflow. If you have particular questions, don't hesitate to post another question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With