我知道我应该使用压缩方法来保存位图文件。
FileOutputStream fos = new FileOutputStream(imagefile);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
fos.flush();
fos.close();
但我想将图像保存为 bmp 格式,而“Bitmap.CompressFormat”仅支持 PNG 和 JPEG。如何将图像文件保存为 BMP 格式?
谢谢,
最佳答案
你可以使用copyPixelsToBuffer
将位图像素存储到缓冲区中,然后将缓冲区写入 sd。
关于android - 如何将图像保存为 BMP 格式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7625577/