The following forum(s) are migrating to a new home on Microsoft Q&A (Preview): Developing Universal Windows apps!

Ask new questions on Microsoft Q&A (Preview).
Interact with existing posts until December 13, 2019, after which content will be closed to all new and existing posts.

Learn More

[UWP] Using GetThumbnailAsync() sometimes will not preserve a gif transparency on its thumbnail RRS feed

  • Question

  • I'm developing an application and there is a page that we need to show a preview list of images from a folder.

    I'm using the StorageFile.GetThumbnailAsync method to retrieve the thumbnail, but for some gif files it will not preserve the background transparency.

    var thumbnail = await file.GetThumbnailAsync(ThumbnailMode.SingleItem);
    BitmapImage bitmapImage = new BitmapImage();
    await bitmapImage.SetSourceAsync(thumbnail);

    I could not find a pattern for this behavior and it seems to be something related to Windows. On Windows Explorer, some gif files show the background as white and some as black, although they were created using the same lib.

    When I open and show the gif file it works fine, only the thumbnail that comes with the black background.

    Does anyone have any idea what could be causing that?

    I've attached some images below of a sample app that I used to isolate the issue.

    Monday, November 25, 2019 7:09 PM

All replies