Android:将图像保存到gallery时出现分辨率问题

Android:将图像保存到gallery时出现分辨率问题,android,imageview,Android,Imageview,我成功地通过编程从相机中拍摄了一张照片,然后将其显示在imageview上,然后在按下按钮后将其保存在Gallery上。 它可以工作,但问题是保存的照片分辨率低。。为什么 我用以下代码拍摄了这张照片: Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST); 然后,我使

我成功地通过编程从相机中拍摄了一张照片,然后将其显示在imageview上,然后在按下按钮后将其保存在Gallery上。 它可以工作,但问题是保存的照片分辨率低。。为什么

我用以下代码拍摄了这张照片:

Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST); 
然后,我使用以下命令将照片保存在var上:

  protected void onActivityResult(int requestCode, int resultCode, Intent data) {  
        if (requestCode == CAMERA_PIC_REQUEST) {  
            thumbnail = (Bitmap) data.getExtras().get("data"); 
        }  
    } 
然后在imageview上显示后,我使用以下功能将其保存在gallery上:

public void SavePicToGallery(Bitmap picToSave, File savePath){


String JPEG_FILE_PREFIX= "PIC";
String JPEG_FILE_SUFFIX= ".JPG";


String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = JPEG_FILE_PREFIX + timeStamp + "_";
File filePath = null;
try {
    filePath = File.createTempFile(imageFileName, JPEG_FILE_SUFFIX, savePath);
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
FileOutputStream out = null;
try {
    out = new FileOutputStream(filePath);
} catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
picToSave.compress(CompressFormat.JPEG, 100, out);
try {
    out.flush();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
try {
    out.close();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

//Add the pic to Android Gallery
String mCurrentPhotoPath = filePath.getAbsolutePath();

MediaScannerConnection.scanFile(this,
        new String[] { mCurrentPhotoPath }, null,
        new MediaScannerConnection.OnScanCompletedListener() {
        public void onScanCompleted(String path, Uri uri) {

        }
});


}
我真的不明白为什么它在保存的同时会失去这么多的质量。。
需要帮忙吗?谢谢。

您在ImageView中显示的照片是缩略图:

data.getExtras().get("data");
是否正在调用该方法:

public void SavePicToGallery(Bitmap picToSave, File savePath)
用缩略图

在这里,您可以描述执行所需操作的所有步骤:

data.getExtras.getdata仅获取缩略图

要正确执行此操作,必须声明全局uri变量

 Uri imageCapturedUri ;


 Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
            imageCaptureUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);
            cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageCaptureUri);
 startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST); 

  protected void onActivityResult(int requestCode, int resultCode, Intent data) {  
     if (requestCode == CAMERA_PIC_REQUEST) {  

          // mImageCaptureUri is your Uri
      }  
  } 

我无法让它工作:/I它只是在我拍完照片后崩溃了