0
的典型方法(根据研究)是:Android的 - 对移动存储保存位图图像,而不从远程URL保存位图图像压缩
Bitmap bmImage = null;
InputStream in = new java.net.URL(imageUrl).openStream();
bmImage = BitmapFactory.decodeStream(in);
File file = new File(myPath);
FileOutputStream outputStream;
outputStream = new FileOutputStream(file);
bmImage.compress(Bitmap.CompressFormat.PNG, 100, outputStream);
outputStream.close();
,除非它被压缩无法保存位图(位图总是未压缩)。 远程图像大小为32KB,压缩后得到110KB。 我知道我必须降低压缩参数才能获得更小的尺寸,但远程图像已经过优化并且效率更高。
有没有办法将远程图像保存在移动存储上而不压缩它?
===== 回答我的问题 =====
首先我误导内容的道歉;我想要的只是保存可能是png | jpeg | gif |等的图像。可能我误导了你们,我试图保存的图像是BMP格式,但事实并非如此。
然而,对于那些谁想要保存图像,而不压缩,看看这个answer
如下面的代码所示
这使得图像尺寸更大; 232KB :( – PeaceDefener
问题解决了,请检查更新。 – PeaceDefener
如何使用这个类? – faisal1208