Skip to content

Instantly share code, notes, and snippets.

@agrocholski
Last active December 12, 2015 12:19
Show Gist options
  • Save agrocholski/4771071 to your computer and use it in GitHub Desktop.
Save agrocholski/4771071 to your computer and use it in GitHub Desktop.
How to get a bitmap image from a file that can be used in your Windows Store UI
public async Task<BitmapImage> GetBitmapFromThumbnail(StorageFile storageFile)
{
//get the thumbnail in VideoView
var thumbnail = await storageFile.GetThumbnailAsync(Windows.Storage.FileProperties.ThumbnailMode.VideosView);
//get the stream from the thumbnail
var thumbnailStream = thumbnail.CloneStream();
//create the bitmap from the stream
var bitmapImage = new BitmapImage();
bitmapImage.SetSource(thumbnailStream);
return bitmapImage;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment