Hi I want to crop Image without moving Overlay view instead move Image.
 
The image can be moved all around. I would like to crop and save the highlighted area as shown below inside the black border.
I have ImageView with android:scaleType="matrix"
Here's my layout code
<RelativeLayout
    android:id="@+imageEdit/rl_ScaleImage"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:layout_below="@+imageEdit/Topbar"
    android:visibility="visible" >
    <ImageView
        android:id="@+imageEdit/imageView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentLeft="true"
        android:scaleType="matrix" />
    <View
        android:id="@+imageEdit/viewTop"
        android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:layout_alignParentTop="true"
        android:background="#99000000" />
    <View
        android:id="@+imageEdit/view_scaledImage"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@+imageEdit/viewBottom"
        android:layout_below="@+imageEdit/viewTop"
        android:background="@drawable/rounded_corner_small" />
    <View
        android:id="@+imageEdit/viewBottom"
        android:layout_width="fill_parent"
        android:layout_height="150dp"
        android:layout_alignParentBottom="true"
        android:background="#99000000" />
</RelativeLayout>
ImageView has OnTouchListener. Image can be zoomed in or zoomed out and is also movable in ImageView1. View view_scaledImage is the area which I want to crop and save. How do I do this?
Finally I got the solution by combining Cropper library and PhotoView libraries.
https://github.com/rameshkec85/AndroidCropMoveScaleImage
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