2016-09-06 95 views
0

我使用裁剪圖像將圖像裁剪功能添加到我的應用程序中。我用TouchImageView作爲我的圖像視圖。剪裁併將裁剪後的圖像設置爲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); 

但是,圖像集現在是模糊的。誰能幫我這個? (我也試圖使用其他可用的裁剪庫..但我只是想知道爲什麼這是行不通的)

回答

0

我假設你打startActivity()Intent與行動com.android.camera.action.CROP

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

+0

謝謝你的迴應!我曾嘗試使用該庫,但我無法遵循他的步驟!你能幫我嗎?我應該在哪裏包括這條線? :Crop.of(inputUri,outputUri).asSquare().start(activity)。我想在我的應用程序中從相機捕捉圖像後立即裁剪圖像。 –

+0

@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)'放在那裏。 –