System.Windows.Media.Imaging and GifBitmapDecoder with animated gif transparency RRS feed

  • Question

  • I tried posting here but could not....Unknown error from MSDN forum.

    I too am having troubles with animated gifs which contain transparency.  If I view them using the System.Drawing and ImageAnimator.Animate I can see them fine...  Using System.Windows.Media.Imaging and GifBitmapDecoder is not working well for me as it looks like it is assuming an alpha (has transparency).  I have searched for how to tell the GifBitmapDecoder to enable or disable alpha...not sure what to do.  Tried creating my own GifBitmapDecoder and using different flags (BitmapCreateOptions.IgnoreColorProfile | BitmapCreateOptions.PreservePixelFormat,and others).

    I've seen these sorts of defects before when using System.Drawing.  I stopped using MakeTransparent() on Bitmap to resolve the visual defects before, but here I can't seem to figure out how to control transparency with Decoder.Frames[x].  Maybe it isn't even an issue with WIC and it is a Control.Image thing...i dunno.

                    animatedImage.Source = ((BitmapFrame)animatedImage.Source).Decoder.Frames[(int)e.NewValue];

    You can see the animation code I'm working with at: Animated GIF Support Behavior « Elad’s WPF Blog .  Great code/article to support animated gifs with WPF behaviors.  I would prefer using WPF behaviors over using System.Drawing.


    Saturday, January 23, 2010 12:39 AM

All replies

  • Hi Dave,

    I'm moving your question to the Windows Presentation Foundation (WPF) forum as this forum only covers problems dealing directly with WIC. While WPF uses WIC internally, the WPF forum is still the best place to receive support for your issue.

    Thursday, February 4, 2010 6:22 PM