【问题标题】:Cropped image is blurred in TouchImageViewTouchImageView 中的裁剪图像模糊
【发布时间】:2017-01-14 09:58:28
【问题描述】:

我使用裁剪意图向我的应用程序添加图像裁剪功能。我使用TouchImageView 作为我的图像视图。裁剪并将裁剪后的图像设置为TouchImageView后,图像变得模糊。在添加此裁剪功能之前,我已经这样做以从相机获取图像数据并将其设置为 TouchImageView 为:

        Uri imageUri;
        TouchImageView myTVF = (TouchImageView) findViewById(R.id.img);
        imageUri = data.getData();
        myTVF.setImageURI(imageUri);

但是现在,为了使用裁剪意图,在图像捕获和裁剪之后,我使用它来将裁剪的图像设置为我的 TouchImageView:

           (....)
            else if(requestCode == PIC_CROP){
            Bundle extras = data.getExtras();
            Bitmap thePic= extras.getParcelable("data");
            myTVF.setImageBitmap(thePic);

但是,图像集现在是模糊的。谁能帮我这个? (我也在尝试使用其他可用的裁剪库。但我只是想知道为什么这不起作用)

【问题讨论】:

    标签: android android-studio imageview android-crop


    【解决方案1】:

    我假设您是在 Intent 上调用 startActivity(),操作为 com.android.camera.action.CROP

    article saying that android doesn't not have crop intent。所以我推荐使用another good 3rd party library.

    【讨论】:

    • 感谢您的回复!我曾尝试使用该库,但无法按照他的步骤进行操作!你能帮我吗?我应该在哪里包括这条线? : Crop.of(inputUri, outputUri).asSquare().start(activity)。我想在我的应用中从相机捕获图像后立即裁剪图像。
    • @ShravanDG 您可以在裁剪完成后调用它。通常我会在protected void onActivityResult(int requestCode, int resultCode, Intent data) 内捕获,使用if (resultCode == RESULT_OK && requestCode == Crop.REQUEST_PICK) 检查resultCode。好了,你可以把Crop.of(inputUri, outputUri).asSquare().start(activity)放在那里。
    猜你喜欢
    • 1970-01-01
    • 2013-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-22
    • 2015-06-30
    • 1970-01-01
    相关资源
    最近更新 更多