2014-06-24 52 views
-1

我試着在下面的代碼中用像素(2448 * 3264)裁剪大圖像。但是,這個過程不能正常工作。請更正下面的代碼或給我另一個解決方案來實現這個圖像裁剪過程。向所有人表示感謝。用2448×3264分辨率裁剪大圖像

private void performCrop(){ 
    try { 

     Intent cropIntent = new Intent("com.android.camera.action.CROP"); 

     cropIntent.setDataAndType(UrlGambar, "image/*"); 

     cropIntent.putExtra("crop", "true"); 

     cropIntent.putExtra("aspectX", 2); 
     cropIntent.putExtra("aspectY", 3); 

     //cropIntent.putExtra("outputX", 256); 
     //cropIntent.putExtra("outputY", 256); 

     cropIntent.putExtra("return-data", true); 

     startActivityForResult(cropIntent, PIC_CROP); 
    } 
    catch(ActivityNotFoundException anfe){ 

     String errorMessage = "Whoops - your device doesn't support the crop action!"; 
     Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT); 
     toast.show(); 
    } 
    } 
} 

回答

1

意向com.android.camera.action.CROP是不是一個標準的Android意圖並且有DONOT支持這一意圖許多設備。請在這篇文章中參考我的answer。我正在使用github的庫進行裁剪。