保存在SD卡上的图像显得更大

时间:2015-02-23 18:30:51

标签: android

我正在保存关于width = 30px和height = 30px的小图像,文件类型是sdcard上的png。在我的SD卡上查看图像后保存图像时,图像显示较大,分辨率较低。然而,原始图像非常清晰。下面是我的代码,请告诉我如何使图像质量更好,并让图像成为原始尺寸,而不是显得更大。感谢

 Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.b_01);

    ByteArrayOutputStream bStream1 = new ByteArrayOutputStream();
    bmp.compress(Bitmap.CompressFormat.PNG, 100, bStream1);

File f1 = new File(Environment.getExternalStorageDirectory() + File.separator + "AppName" + "/bmp.png");
    if(!f1.exists()) {
        try {

            f1.createNewFile();
            FileOutputStream fs1 = new FileOutputStream(f1);
            fs1.write(bStream1.toByteArray());
            fs1.close();

        } catch (IOException e) {
            e.printStackTrace();
        }
    }

0 个答案:

没有答案