获取 GIF 图片的帧数

using System.Drawing;
using System.Drawing.Imaging;
 
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        private void button1_Click(object sender, EventArgs e)
        {
            string imgPath = @"d:\test2.gif";
            Bitmap bmp = new Bitmap(imgPath);
            Guid[] guids = bmp.FrameDimensionsList;
            FrameDimension fd = new FrameDimension(guids[0]);
            int frameCount = bmp.GetFrameCount(fd);
        }
}
 

你可能感兴趣的:(获取 GIF 图片的帧数)