Android将位图保存到媒体而不进行压缩,并将其设置在图像视图中

时间:2016-10-05 13:11:27

标签: android bitmap imageview compression

   //CROP INTENT
    private void doCropping
   {
    Intent cropIntent = new Intent("com.android.camera.action.CROP");
    cropIntent.setDataAndType(selectedImageUri, "image/*");
    cropIntent.putExtra("crop", "true");

    cropIntent.putExtra("aspectX", 16);
    cropIntent.putExtra("aspectY", 9);

    cropIntent.putExtra("aspectX", 1);
    cropIntent.putExtra("aspectY", 1);

    cropIntent.putExtra("return-data", true);
    try {
        ((Activity) context).startActivityForResult(cropIntent, code);
    } catch (Exception e) {

    }
}

//CROP RESULT

 private void resultOnCropOkOfGallary(Intent data) {
    Bundle extras2 = data.getExtras();
    this.bitmap = extras2.getParcelable("data");
    if (this.bitmap != null) {
        //ivPicture is Imageview.
        ivPicture.setImageBitmap(bitmap);
    }

}

裁剪完成后我得到了图像。但它使图像质量低。 我在imageview上设置了模糊图像。请解决。谢谢。

1 个答案:

答案 0 :(得分:1)