2012-08-31 46 views
0

裁剪特定圖像我要裁剪出現在SD卡。我的代碼的圖像是:從SD卡

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

     Uri uriOfImageToCrop = Uri.parse(Environment.getExternalStorageDirectory()+"/bookpage.jpg"); 
     intent.setDataAndType(uriOfImageToCrop, "image/*"); 
     intent.putExtra("outputX", 200); 
     intent.putExtra("outputY", 200); 
     intent.putExtra("aspectX", 1); 
     intent.putExtra("aspectY", 1); 
     intent.putExtra("scale", true); 
     intent.putExtra("noFaceDetection", true); 
     intent.putExtra(MediaStore.EXTRA_OUTPUT, uriOfImageCrop); 
     startActivity(intent); 

但它顯示了以下異常: java.lang.IllegalStateException:目標主機不能爲空或者在參數中設置。 任何人都可以幫助我。

回答

0

您可以使用http://code.google.com/p/catalano-framework/

FastBitmap fb = new FastBitmap(bitmap); 
int startX = 10; 
int startY = 10; 
int newWidth = 100; 
int newheigth = 100; 

Crop crop = new Crop(startX, startY, newWidth, newHeigth); 
crop.applyInPlace(fb);