-3

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

Asha Soman
  • 199
  • 2
  • 3
  • 11
  • Is it possible to crop the selected part of the image using this? – Asha Soman Oct 08 '12 at 09:50
  • 1
    All your questions have already been answered: [Moving image][1], [Scaling Image][2] and [Cropping Image][3] [1]: http://stackoverflow.com/questions/8696025/how-to-move-a-image-across-the-screen-on-android [2]: http://stackoverflow.com/questions/2521959/how-to-scale-an-image-in-imageview-to-keep-the-aspect-ratio [3]: http://stackoverflow.com/questions/3725501/how-to-crop-the-parsed-image-in-android – slezadav Oct 08 '12 at 09:51

2 Answers2

1

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);
Shishir Shetty
  • 2,021
  • 3
  • 20
  • 35
-2
<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

Syn3sthete
  • 4,151
  • 3
  • 23
  • 41