相关疑难解决方法(0)

从相机捕获时图像/图像质量低

我有一个问题.当我试图从相机拍摄照片时,质量非常低.首先,使用相机拍摄图片,而不是保存到目录,同时获取该图片并在我的应用程序中显示.目录中保存的图片质量很好但是当我从目录中获取时,质量很低.下面是我的示例代码:

public void onActivityResult(int requestCode, int resultCode, Intent intent) {

    if (requestCode == CAMERA_PIC_REQUEST) {  

        Bitmap thumbnail = (Bitmap) intent.getExtras().get("data");

        if (g==1)
        {
            ImageView myImage = (ImageView) findViewById(R.id.img5);
            myImage.setImageBitmap(thumbnail);

            View a = findViewById(R.id.img5);
            a.setVisibility(View.VISIBLE);

            ByteArrayOutputStream stream = new ByteArrayOutputStream();
            thumbnail.compress(Bitmap.CompressFormat.JPEG, 100, stream);

            byteArray1 = stream.toByteArray();
        }
}
Run Code Online (Sandbox Code Playgroud)

任何解决方案/建议?谢谢 :)

解决了

当我按照下面的Antrromet给出的代码时,问题就解决了

android android-camera-intent

36
推荐指数
2
解决办法
6万
查看次数

标签 统计

android ×1

android-camera-intent ×1