我知道保存位图文件时应该使用压缩方法。
FileOutputStream fos = new FileOutputStream(imagefile);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
fos.flush();
fos.close();
但是我想将我的图像保存为BMP格式,而“Bitmap.CompressFormat”仅支持PNG和JPEG。我该如何将我的图像文件保存为BMP格式?
谢谢。
我知道保存位图文件时应该使用压缩方法。
FileOutputStream fos = new FileOutputStream(imagefile);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
fos.flush();
fos.close();
但是我想将我的图像保存为BMP格式,而“Bitmap.CompressFormat”仅支持PNG和JPEG。我该如何将我的图像文件保存为BMP格式?
谢谢。
你可以使用copyPixelsToBuffer将位图像素存储到缓冲区中,然后将缓冲区写入SD卡。