none
System.Windows.Media.Imaging and GifBitmapDecoder with animated gif transparency

    Question

  • I tried posting here but could not....Unknown error from MSDN forum.
    http://social.msdn.microsoft.com/forums/en-US/windowswic/thread/96715fe2-27a7-46bf-8362-baeb615ac5f3/

    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.

    Cheers,
    --dave
    http://dave.thehorners.com/tech-talk/programming

    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.

    Simon
    Thursday, February 4, 2010 6:22 PM