如何制作高分辨率图像

时间:2016-08-05 10:25:29

标签: android image high-resolution

我创建了一个使用过滤器图像的应用程序并保存在sdcard中,它的工作正常但是我希望将图像保存为两个分辨率高低,我从未尝试过分辨率,任何一个都可以帮助如何保存这两种分辨率?我的代码在

之下
private void saveBitmap(Bitmap bmp, String fileName, int resolution, String resolutionQuality) {
//            File f = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + fileName + ".png");
        File f = new File(Environment.getExternalStorageDirectory() + "FiltureImages");
        if (!f.exists()) {
            File wallpaperDirectory = new File("/sdcard/FiltureImages/");
            wallpaperDirectory.mkdirs();
        }
        File file = new File(new File("/sdcard/FiltureImages/"), fileName + resolutionQuality + ".png");
        if (file.exists()) {
            file.delete();
        }
        try {
            fos = new FileOutputStream(file);

            bmp.compress(Bitmap.CompressFormat.PNG, resolution, fos);
            Toast.makeText(mActivity, "Image save successfully", Toast.LENGTH_SHORT).show();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

2 个答案:

答案 0 :(得分:0)

以这种方式创建第二个具有替代分辨率的位图,并将scaledBmp.compress()调用到新文件中。

        Bitmap scaledBmp = Bitmap.createScaledBitmap(bmp, newWidth, newHeight, false);

答案 1 :(得分:0)

像这样调用io/console not supported; tty will not be manipulated ←[31mfetched an invalid config {:config=>"input { \n file {\n path => \"D:\ \elastic\\logstash\\data\\data.csv\"\n start_position => \"beginning\" \n }\n}\nfilter { \n csv {\n separator => \",\"\n columns => [\"Date\"......

质量范围从saveBitmap(bm, "high", "low", 100, 0, "quality");

注意:0 -100更改为Bitmap.CompressFormat.PNG beacuse quality适用于JPEG格式。

Bitmap.CompressFormat.JPEG