I am writing a function to display images in a folder (suppose I have about 60 images in this folder) in the phone window 8.1. And the problem is that the GetThumbnailAsync () function takes so long when I create a stream to get bitmapImage. Here is my code
//getFileInPicture is function get all file in picture folder List<StorageFile> lstPicture = await getFileInPicture(); foreach (var file in lstPicture) { var thumbnail = await file.GetThumbnailAsync(Windows.Storage.FileProperties.ThumbnailMode.PicturesView,50); var bitmapImage = new BitmapImage(); bitmapImage.DecodePixelWidth = (int)(ScreenWidth / 4); await bitmapImage.SetSourceAsync(thumbnail); g_listBitmapImage.Add(bitmapImage); //g_listBitmapImage is a list of bitmapImage }
I was test and found a problem, the GetThumbnailAsync function takes so long . If I have about 60 images, it will take about 15 seconds to complete this function (I'm testing in lumia 730). Does anyone have this problem and how to make this code faster? .
Thanks so much for your support.
source share