Search code examples
xamarin.iosuwpffimageloading

UWP - Black color instead of transparency


This is an issue for xamarin.uwp and FFImageLoading, but it reproduces only in UWP.

The issue with optimized files by Photoshop.

I optimized my images on a server with Photoshop. I exported them with option Smaller File (8-bit) after it I got black color in UWP (ios and android are ok).

When I deleted downsample parameters for CachedImage(FFImageLoading control) then transparency was back.

Example:

enter image description here

And files before optimization and after it

enter image description here

enter image description here


Solution

  • It's a bug, please make a separate issue on project site. It's related to this:

    8 bit PNG can have no more than 256 colors. A part of the PNG file structure holds pointers to 256 colors and then each pixel in the image gets its color from one of those pointers. Thus each pixel only consumes one bytem its 0-255 value pointing to its color on the palette. On the other hand, a 32 bit PNG is 4 bytes per pixel and each pixel can represent a different ARGB color value. Pixel Format

    // Edit I created it: https://github.com/luberda-molinet/FFImageLoading/issues/986