*我正在开发一个应用程序,我必须拍摄图像,裁剪它然后继续进一步实现。当我捕获图像并将其保存到SD卡时它的质量很好但是当我尝试在裁剪后保存图像时它的质量最差。 以下是我的代码
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
if (arg0.getId() == R.id.captureimage) {
try {
//use standard intent to capture an image
final Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, CAMERA_CAPTURE);
}
catch(Exception e){ String errorMessage = "your device doesn't support capturing images!";
Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT);
toast.show();}
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CAMERA_CAPTURE) {
Uri picUri = data.getData();
performCrop(picUri);
}
else if(requestCode == PIC_CROP){this.finish();
Intent i=new Intent(getApplicationContext(),display.class);
i.putExtra("jao", "jao");
startActivity(i);}
else {
Log.v("", "User cancelled");
}
}private void performCrop(Uri picUri) {
// TODO Auto-generated method stub
Intent cropIntent = new Intent("com.android.camera.action.CROP");
//indicate image type and Uri
cropIntent.setDataAndType(picUri, "image/*");
//set crop properties
cropIntent.putExtra("crop", "true");
//indicate aspect of desired crop
cropIntent.putExtra("aspectX", 1);
cropIntent.putExtra("aspectY", 1);
//indicate output X and Y
cropIntent.putExtra("outputX", 256);
cropIntent.putExtra("outputY", 256);
File file = new File(_path);
Uri outputFileUri = Uri.fromFile(file);
cropIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
//retrieve data on return
cropIntent.putExtra("return-data", true);
//start the activity - we handle returning in onActivityResult
startActivityForResult(cropIntent, PIC_CROP);
}
请指导我如何使我的裁剪图像质量更好,因为质量差的图像我无法完成其他任务....