The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
[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

  • Hi,

    When I tried to create gif files and showed the thumbnail, it worked well. So can you please provide the two gif files you marked in picture1 for us to test?

    Best Regards,

    Fay


    "Developing Universal Windows apps" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Tuesday, November 26, 2019 3:16 AM
  • Hi Fay,

    Thanks for helping. 

    Unfortunately, I don't have the ones used in the images attached.

    I have these other 3 that causes the same issue. I'm sharing using Google Drive as they are too big to upload here.

    https://drive.google.com/file/d/16E4D_r_KnrIz91ATyi7ign2ZmogoZGti/view?usp=sharing

    https://drive.google.com/file/d/1IYF2xqUmAypNT5coEZLXA7vD-tlCtfkv/view?usp=sharing

    https://drive.google.com/file/d/1Yqi7Wvri5RFE2sEnITajPdPvqAZkJmck/view?usp=sharing

    Tuesday, November 26, 2019 5:50 PM
  • Hi,

    Based on the three gif files, it indeed shows the black background in the thumbnail. And I wonder what lib you used to create these gif files? In addition, if possible, you can check the background image layers from the gif to see if there is any difference between them.

    Best Regards,

    Fay


    "Developing Universal Windows apps" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Wednesday, November 27, 2019 9:32 AM
  • Hi,

    Is there any update?

    The UWP section of MSDN is about to be locked down. If you have other questions, please come to Microsoft Q&A to ask questions, and we will continue to answer your questions there.

    Best Regards,

    Fay


    "Developing Universal Windows apps" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Tuesday, December 3, 2019 8:35 AM
  • Hi,

    Is there any update?

    The UWP section of MSDN is about to be locked down. If you have other questions, please come to Microsoft Q&A to ask questions, and we will continue to answer your questions there.

    Best regards,

    Fay


    "Developing Universal Windows apps" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Friday, December 6, 2019 8:24 AM
  • Hi,

    Is there any update?

    The UWP section of MSDN is about to be locked down. If you have other questions, please come to Microsoft Q&A to ask questions, and we will continue to answer your questions there.

    Best regards,

    Fay


    "Developing Universal Windows apps" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Monday, December 9, 2019 9:20 AM
  • Hi,

    Is there any update?

    The UWP section of MSDN is about to be locked down. If you have other questions, please come to Microsoft Q&A to ask questions, and we will continue to answer your questions there.

    Best regards,

    Fay


    "Developing Universal Windows apps" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Tuesday, December 10, 2019 9:08 AM
  • Hi,

    Is there any update?

    The UWP section of MSDN is about to be locked down. If you have other questions, please come to Microsoft Q&A to ask questions, and we will continue to answer your questions there.

    Best regards,

    Fay


    "Developing Universal Windows apps" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Wednesday, December 11, 2019 7:57 AM
  • Hi,

    I haven't heard from you these days. MSDN UWP Forum will be locked down on 12/13/2019 and this UWP Forum is migrating to a new home on Microsoft Q&A (Preview) from 10/30/2019( for more information please check here:‘Developing Universal Windows apps’ forum will be migrating to a new home on Microsoft Q&A (Preview)! ).  Since your question is still open, I'll help you to create a new question in Microsoft Q&A. We could continue to discuss the issue here.

    Best regards,
    Fay


    "Developing Universal Windows apps" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Thursday, December 12, 2019 8:52 AM