GIF image loses its animation in Magick.net

孤街醉人 提交于 2019-12-08 12:46:16

问题


I am reading a GIF image and creating the ImageMagick object in C#. Then I write the same image to the output. In the output I get a static image without animation.

               MagickImage image = new MagickImage(ImagePath); 
               Byte[] buffer = image.ToByteArray();                                         
               HttpContext.Current.Response.ContentType = "image/gif";                                 
               HttpContext.Current.Response.OutputStream.Write(buffer, 0, buffer.Length);     
               HttpContext.Current.Response.StatusCode = 200; 

回答1:


A MagickImage is a single image. When you read a .gif file you will only get the first frame of that animation. If you want to preserve the animation you should create a MagickImageCollection instead.



来源:https://stackoverflow.com/questions/35270389/gif-image-loses-its-animation-in-magick-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!