如何调整存储在位图中的gif的大小 [英] How to resize gif which is stored in bitmap
本文介绍了如何调整存储在位图中的gif的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图调整Gif图像的大小但是在调整大小后它不会动画。我试着跟随代码调整大小。
我尝试过:
i tried to resize Gif image but after resizing it will not animating. i tried following code resize.
What I have tried:
LastBitImg = new Bitmap(Convert.ToInt32(FNewWidth), Convert.ToInt32(height));
LastBitImg = FBitImg;
推荐答案
动画GIF不是单个图像,而是一系列图像(也称为帧)附加数据,如帧延迟。您必须将动画GIF分割为帧图像作为位图,调整大小,并使用原始帧数据创建新的动画GIF。
这里有一篇文章在CP上使用.Net创建动画GIF: NGif,用于.NET的动画GIF编码器 [ ^ ]。
或者使用支持调整动画GIF大小的图像库,如ImageMagick(GitHub:dlemstra / Magick.NET [ ^ ]。
An animated GIF is not a single image but a sequence of images (also called frames) with additional data like the frame delay. You have to split the animated GIF into it's frame images as bitmaps, resize them, and create a new animated GIF using the original frame data.
There is an article here at CP on creating animated GIFs with .Net: NGif, Animated GIF Encoder for .NET[^].
Alternatively use an image library that supports resizing animated GIFs like ImageMagick (there is a .Net wrapper at GitHub: dlemstra/Magick.NET[^] ).
这篇关于如何调整存储在位图中的gif的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文