在我的应用程序中,我想用相机拍照并将它们保存在文件中。照片质量在我的应用程序中非常重要,所以当我压缩保存它时,图像质量会丢失。这是我的代码:
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
FileOutputStream outStream = null;
saveFullImage();
if ((requestCode == TAKE_PICTURE))
{
if (data != null)
{
if (data.HasExtra("data"))
{
Bitmap pic = (Bitmap)data.Extras.Get("data");
System.IO.MemoryStream baos = new System.IO.MemoryStream();
pic.Compress(Bitmap.CompressFormat.Png, 100, baos);
byte[] byte_img_data = baos.ToArray();
outStream = new FileOutputStream(outputFileUri.Path);
outStream.Write(byte_img_data);
outStream.Close();
}
}
}
}
请帮我。谢谢。