0
您好,我正在開發一個攝像機應用程序。拍攝圖像後,圖像將保存在SD卡中。我想要保存在SD卡中的圖像大小應該是400kb到500kb,但現在它需要超過1mb。捕捉圖像後如何壓縮並保存在SD卡中。在Android中拍攝圖像時壓縮圖像
我的代碼是
public void onClick(View v) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
imageName="MyCameraApp" + String.valueOf(System.currentTimeMillis()) + ".jpg";
File file = new File(Environment.getExternalStorageDirectory()+"/pictures", imageName);
fileUri = Uri.fromFile(file);
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name
startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
}