How do I fix the size of the cropping rectangle?

Possible duplicate:
How to fix the image scale to crop the image?

In my application, user can select an image from gallery and after that he can zoom in / out the image. I want to fix the height and width of the rectangle by enlarging the image to crop the image. How to do it? a lot, but still not able to solve the problem. Please help me with my this problem. I've tried this.

//intent.setData(mImageCaptureUri);
        intent.putExtra("crop", "true");
        intent.putExtra("outputX", 200);
        intent.putExtra("outputY", 200);
        intent.putExtra("aspectX", 3);
        intent.putExtra("aspectY", 4);
        intent.putExtra("scale", true);
        intent.putExtra("return-data", true);

      

+3


source to share


1 answer


  Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null)
        .setType("image/*")
        .putExtra("crop", "true")
        .putExtra("aspectX", width)
        .putExtra("aspectY", height)
        .putExtra("outputX", width)
        .putExtra("outputY", height)
        .putExtra("scale", true)
        .putExtra("scaleUpIfNeeded", true)
        .putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f))
        .putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());

      



0


source







All Articles