Forms Image Cache

CaseyNiemannCaseyNiemann USMember ✭✭

We are using xamarin.Forms in our app. Our app is media intensive meaning there many images as picture of users, also we are capturing images from device camera. we store this images in azure blob storage.

So loading image is so slow on mobile device and the app becomes slow. We trued applying CacheEnabled option of Uriimagesource with CacheValiditity, but is not working properly.
following is the code snipped which we are using:
var img = new Image
Source = new UriImageSource {
CachingEnabled = true,
CacheValidity = new TimeSpan(5,0,0,0),
Uri = new Uri(item.ImageUrl) },

so can you tell me is there any way to load the image faster via cache.
Please note that we also want to implement offline mode meaning the user can access app in offline mode.


  • stvansolanostvansolano UMInsider, University ✭✭✭

    Hello @CaseyNiemann

    You could consider a cell-level caching strategy as the following:

  • AndrewMobileAndrewMobile USMember ✭✭✭✭

    UriImageSource is saving the images to device storage.
    How big are your images and how do you use them, how do you display them? In a ListView?

  • sudhir.9350sudhir.9350 INUniversity ✭✭
    edited June 2015

    @AndreiNitescu - we are reducing image by making its thumbnails on server side. We allow user to capture the image from his device camera and then we store those images to azure blobstorage and then load it from there. We display image in listview and also in some place in horizontal stacklayout.

  • DonBoxDonBox USMember ✭✭

    What's the size of the "thumbnail" you return from server?
    Also, are you using latest Xamarin Forms version?

  • sudhir.9350sudhir.9350 INUniversity ✭✭
    edited June 2015

    @DonBox - The original taken photo's size is around 1.7Mb but after thumbnails it reduces to some 3 Kbs. We use Xamarin.Forms.

  • GeorgeCookGeorgeCook PEUniversity ✭✭✭
    edited June 2015

    @CaseyNiemann as @stvansolano said, you can use my cell caching viewcell extension for optimal performance. If not, just use the FastImage. class that comes in the library

  • AndrewMobileAndrewMobile USMember ✭✭✭✭

    @sudhir.9350 if the images you are loading are from URL and are 3kb, then there should be no reason for them to load slowly. When loading from a URL, the ImageSource is caching the images on disk.

  • AnkhiyaShahAnkhiyaShah INMember ✭✭

    if images are cached to disk, then in my case why every time it is showing loading, i am not getting even if it is getting cached or not.

    can anyone reply.

    Thank you in advance

Sign In or Register to comment.