How to reduce image quality when using Universal Image Loader? - android

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. 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
DisplayImageOptions profilepicOptions = new DisplayImageOptions.Builder()
.showStubImage(R.drawable.user_pic).cacheInMemory()
.cacheOnDisc().bitmapConfig(Bitmap.Config.ARGB_4444).build();

Related

How to increase Image Memory using Bitmap Factory option

I want to use Big Size Image In Back Ground so How Can I do And i want to It's Working For All Device
As per your requirement, I guess that you are getting image from server end. Some time big size Bitmap throw OutOfMemoryException. So do one thing. Use this library to compress image and then show it to ImageView.
https://github.com/zetbaitsu/Compressor
You can also use Library. It provide you facility to fix image size and quality. so it won't be problem for you.
Nostra Image Loader

Glide takes long time before displaying large images

I am trying to load images (around 5mb each) into ImageView's of size 45x45 dp in a RecyclerView. Even though original image is large, doesn't Glide load a smaller version of it because target ImageView is small? So, I expect Glide to load images in just a few seconds with an average internet speed. But, it takes like 20 seconds. What is the problem?
Images are stored in firebase storage.
Glide code :
Glide.with(context).load(firebaseStorageUrl).into(imageView);
Glide needs to load the full image from the internet before it can resize it. So the download takes a long time the first time. Afterwards it can use the small image from the cahe it created if you have caching activated.
In case you don't want to load smaller files, I recommend using a Gif-drawable library for loading large images from Glide into GifDrawable(works as an ImageView).
It can load files more than 100MB very fast. It works with plain JPG, PNG and BMP too. If these are GIFs, it plays without any delay or freeze.
If drawables declared by android:src and/or android:background are GIF files then they will be automatically recognized as GifDrawables and animated. If given drawable is not a GIF then mentioned Views work like plain ImageView and ImageButton.
Glide downloads the image first, and then you have methods to retrieve the image as bitmap to resize and compress the image. However, that won't solve your problem . Possibly there are two solutions for this:
Keep a low sized image in the server.
Use a File downloader library, which helps to download images serially and asynchronously as a queue, which would help to download the file quick. FileDownloader library is a good option for this.
Use Override in Glide for load image faster.

which is best? Creating bitmap from imageview or downloading the file

we are using an app for setting wallpaper in android device, for that we are doing below steps
1) we have set of images and URLs
2) We are fetching the URL on an Imageview
so now we have to set the wallpaper, for that we need the image file, which is the best way to do it?
1) Download the file directly from URL and store it in a local storage and use it as wallpaper.
or
2) Create a bitmap from the Imageview and use it as wallpaper.
Doing the second option will reduce any quality of the image we using?
First option how to we can do it?
We have fetch the images successfully inside the application.
Always prefer to cache your image downloads so that you don't have to repeat the task. Using libraries like Picasso or Glide reduces a lot of effort is handling your images while at the same time optimizing your code.
Additionally it's best to use the original image as wallpaper rather than consuming the image view because if you have set any scale type's on your image view then your image will be cropped.
Picasso allows for hassle-free image loading in your application—often in one line of code!
Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);

Reducing Image Size at Runtime for Android app

I am parsing a json schema which contains textual info and image urls for my android app. I want to read all the images from the schema and then show them in the gallery view of my android app.
But the problem is, the image urls contain HD pics and it takes a lot of time to load. Is there a way I can reduce the size of those images at run time and then display or can you suggest any improvement tip so that the images could load quickly from the schema?
Thanks
Try using Picasso library, it can resize your images whatever you like and bind it to ImageView. See also my answer here.
But if your images on your server are too big, it all depends on your internet connection, how fast they get to your device.
You can resize your image downloaded from url using picasso library. Also it will allow lazy loading of images and you can also set placeholder and error images in your imageview.
You can read complete documentation here: http://square.github.io/picasso/
Picasso.with(context)
.load(url)
.resize(50, 50)// resizing images
.centerCrop()
.into(imageView)

Load a downscaled image with Android-Universal-Image-Loader

I am using Android-Universal-Image-Loader to load an image into an imageView. Is it possible to show a downscaled version of the image i am loading while the original image has not yet loaded?
As suggested here, the way to achieve your goal would be prepare and download two images, one with less size to show as preview while the big one is downloading

Categories

Resources