I have an Imageview in my android application. I want to move and scale the image. Also I want to crop the selected part of the image (Just like a Photo/Image editor). How can i achieve this?
Thanks in Advance
I have an Imageview in my android application. I want to move and scale the image. Also I want to crop the selected part of the image (Just like a Photo/Image editor). How can i achieve this?
Thanks in Advance
Do something like this :
Intent intent = new Intent("com.android.camera.action.CROP");
// this will open all images in the Galery
intent.setDataAndType(photoUri, "image/*");
intent.putExtra("crop", "true");
// this defines the aspect ration
intent.putExtra("aspectX", aspectY);
intent.putExtra("aspectY", aspectX);
// this defines the output bitmap size
intent.putExtra("outputX", sizeX);
intent.putExtra("outputY", xizeY);
// true to return a Bitmap, false to directly save the cropped iamge
intent.putExtra("return-data", false);
//save output image in uri
intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
<ImageView
android:id="@+id/imgProfilePic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/image"
android:scaleType="fitCenter" <!-- TO CROP/SCALE -->
android:gravity="center" <!-- TO MOVE -->
/>
hope this helps you