android – 从互联网下载图像损失透明度

android – 从互联网下载图像损失透明度,第1张

概述当我从互联网上下载图像并保存到SD卡时,当原始图像没有时,图像有黑色背景 httpRequest = new HttpGet(fileUrl); HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = (HttpResponse) httpclient.execute(httpRequest); Htt 当我从互联网上下载图像并保存到SD卡时,当原始图像没有时,图像有黑色背景

httpRequest = new httpGet(fileUrl); httpClIEnt httpclIEnt = new DefaulthttpClIEnt(); httpResponse response = (httpResponse) httpclIEnt.execute(httpRequest); httpentity entity = response.getEntity(); Bufferedhttpentity bufhttpentity = new Bufferedhttpentity(entity); inputStream instream = bufhttpentity.getContent(); Bitmap    bm = BitmapFactory.decodeStream(instream); String file_path = Environment.getExternalStorageDirectory()+file.separator+"basquetMobile-  images"; file dir = new file(file_path);      if(!dir.exists())        dir.mkdirs(); file file = new file(dir,tipoImagen+IDEquipo+".jpg"); fileOutputStream fOut = new fileOutputStream(file); bm.compress(Bitmap.CompressFormat.JPEG,75,fOut); fOut.flush(); fOut.close();

谢谢您的帮助!!

>>>>>>>>>>>>>>>>>>>>>> [溶液]<&LT ;<<<<<<<<<<<<<<<>>>>>

更改:

文件文件=新文件(dir,tipoImagen IDEquipo“.png”);

bm.compress(Bitmap.CompressFormat.PNG,100,fOut);

>>>>>>>>>>>>>>>>>>>>>>感谢和LT;!< <<<<<<<<<<<<<<<>>>>>

解决方法 更改:

文件文件=新文件(dir,fOut);

总结

以上是内存溢出为你收集整理的android – 从互联网下载图像损失透明度全部内容,希望文章能够帮你解决android – 从互联网下载图像损失透明度所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1127223.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存