WPF:通过MemoryStream使用ImageMagick显示gif

WPF:通过MemoryStream使用ImageMagick显示gif,wpf,imagemagick,gif,memorystream,Wpf,Imagemagick,Gif,Memorystream,我试图通过正常的图像控件显示动画gif: <Image Name="animationImagePlayer"/> 我看到序列的一帧,没有动画机制。 我试图将流保存在一个gif文件中,它工作得非常完美。PictureBox示例 你需要保持畅通 System.IO.MemoryStream gifStream = new System.IO.MemoryStream(); 在方法Write()中,使用MagickFormat.Gif,否则在流中写入静态图像 pictureEd

我试图通过正常的图像控件显示动画gif:

<Image Name="animationImagePlayer"/>

我看到序列的一帧,没有动画机制。
我试图将流保存在一个gif文件中,它工作得非常完美。

PictureBox示例

  • 你需要保持畅通

     System.IO.MemoryStream gifStream = new System.IO.MemoryStream();
    
  • 在方法Write()中,使用MagickFormat.Gif,否则在流中写入静态图像

     pictureEditor.image.Write(gifStream, MagickFormat.Gif);
     pictureBox1.Image = Image.FromStream(gifStream);
    

  • “单帧序列,没有动画机制”正是图像元素应该做的。您是否在web上搜索过例如“wpf动画gif”?相同的解决方案在winforms上使用picturebox,我不明白为什么不应该在wpf上使用ImageWPF和winforms是不同的框架。如果WinForms PictureBox显示动画GIF,则不能断定WPF图像元素也显示动画GIF。我没有考虑,我想考虑一个可能的答案,一个关于使用的控制类型的建议,或者一个使用IMAMEGAGIC+内存流的解决方案的一般性的重新阐述。
     pictureEditor.image.Write(gifStream, MagickFormat.Gif);
     pictureBox1.Image = Image.FromStream(gifStream);