GIF图像在Magick.net中丢失了动画 [英] GIF image loses its animation in Magick.net

查看:149
本文介绍了GIF图像在Magick.net中丢失了动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在读取GIF图像并在C#中创建ImageMagick对象.然后,我将相同的图像写入输出.在输出中,我得到一个没有动画的静态图像.

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; 

推荐答案

MagickImage是单个图像.读取.gif文件时,您只会得到该动画的第一帧.如果要保留动画,则应创建一个MagickImageCollection.

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.

这篇关于GIF图像在Magick.net中丢失了动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆