在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
C#获取gif帧数 /// <summary> /// 获取gif帧数 /// </summary> /// <param name="gifBytes"></param> /// <returns></returns> public static int GetGifFrameNum(string etc, byte[] gifBytes) { try { if (etc == ".gif") { MemoryStream ms = new MemoryStream(gifBytes); Image gif = Image.FromStream(ms); FrameDimension fd = new FrameDimension(gif.FrameDimensionsList[0]); int count = gif.GetFrameCount(fd); ms.Dispose(); gif.Dispose(); return count; } else { return 1; } } catch (Exception ex) { LogHelper.WriteLog(ex); return 0; } }
|
请发表评论