Skip to content

Best way to load a large number of images from URLs #9878

Answered by maxkatz6
christosk92 asked this question in Q&A
Discussion options

You must be logged in to vote

I noticed unlike UWP/WPF, only accepts local paths.

Image.Source accepts IImage, which usually is an instance of Bitmap.
Bitmap can be created from a stream.

I tried making a custom converter, downloading the image to a stream and then loading it, but this consumes massive amounts of Memory and is slow.

It really depends on how exactly you are downloading these images. Is it async, is it in parallel...

Before I used this image subclass with some HttpClient helpers https://gist.github.com/maxkatz6/bc6e25db4323ede3b9a631cd7511cdb5
You might notice Bitmap.DecodeToHeight part - it is mostly needed if you have large original images that needs to be resized to a smaller size while decoding…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@timunie
Comment options

@tuyen-vuduc
Comment options

Answer selected by christosk92
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants