
我正在使用应用程序获取gps位置并将其绘制为位图上的圆圈,然后将其保存以继续,因此我需要重复读取并保存文件.但不幸的是,当我保存文件并读取它时,文件在一些迭代后被损坏了……!代码:
file output = new file(tmpDirectory, "map.jpg"); try { OutputStream outputStream = new fileOutputStream(output); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream); outputStream.flush(); outputStream.close(); } catch (Exception ex) { Message("error!"); } directory = tmpDirectory;//updating directory to load the manipulated image readfile(directory + "map.jpg", false);//setting the image vIEw new image包含的图像:picture after iterations
图像包括:
main image
解决方法:
JPEG使用有损压缩.这意味着每次迭代都会失去一些质量.如果你想保留它,你应该使用像PNG这样的无丢失格式.
bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream); 总结 以上是内存溢出为你收集整理的android – bitmap.compress破坏图片质量全部内容,希望文章能够帮你解决android – bitmap.compress破坏图片质量所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)