4
我知道我应该使用compress方法来保存位图文件。如何将图像保存为BMP格式?
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); \t \t ByteBuffer bf = ByteBuffer.allocate(width * height * 4); \t \t bitmap.copyPixelsToBuffer(bf); \t \t fos.write(bf.array()); \t \t fos.flush(); \t \t fos.close(); \t \t return true;' – breceivemail
对不起,我只是误解了文档。抱歉 – Blackbelt