简体   繁体   English

使用Universal Image Loader时如何降低图像质量?

[英]How to reduce image quality when using Universal Image Loader?

I'm using Universal Image Loader and I have to load 17 images from this page http://www.mangareader.net/detective-conan/898 then display it into ViewPager. 我正在使用Universal Image Loader,并且必须从此页面http://www.mangareader.net/detective-conan/898加载17张图像,然后将其显示到ViewPager中。 However, images load very slow so I want to reduce the image quality and size for performance. 但是,图像加载非常慢,因此我想降低图像质量和尺寸以提高性能。 What should I do to improve the speed? 我应该怎么做才能提高速度? Thanks. 谢谢。

I think it is not posible to download a scaled down version of image if the server does not supprt that feature. 我认为,如果服务器不支持该功能,则无法下载缩小版本的映像。 You can read more about it here . 您可以在此处了解更多信息。

One soltion to this is you can cache images when you run it for the first time. 一种解决方法是,您可以在第一次运行图像时缓存图像。 And next time check if the image is available in cache or not. 下次检查图像是否在缓存中可用。 if it is present in cache, get it from device else download it and cache it. 如果它存在于缓存中,请从设备获取它,否则将其下载并缓存。

use BitmapConfigARGB_4444 使用BitmapConfigARGB_4444

DisplayImageOptions profilepicOptions = new DisplayImageOptions.Builder()
                               .showStubImage(R.drawable.user_pic).cacheInMemory()
                               .cacheOnDisc().bitmapConfig(Bitmap.Config.ARGB_4444).build();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM