C#操作GIF图片(下)将一帧一帧的图片合并成gif

见过不少人、经过不少事、也吃过不少苦,感悟世事无常、人心多变,靠着回忆将往事串珠成链,聊聊感情、谈谈发展,我慢慢写、你一点一点看......

string newPath = Application.StartupPath + "\\new.gif";

List imgs = Directory.GetFiles(Application.StartupPath + "\\images\\", "*.jpg").ToList();            
imgs.Sort((a, b) =>            {
  
                  string reg = "[0-9]+";                int a_index = int.Parse(Regex.Match(a, reg).Value);                int b_index = int.Parse(Regex.Match(b, reg).Value);                return a_index > b_index ? 1 : a_index < b_index ? -1 : 0;            });            AnimatedGifEncoder ae = new AnimatedGifEncoder();            ae.Start(newPath);            ae.SetDelay(120);   // 延迟间隔            ae.SetRepeat(0);  //-1:不循环,0:循环播放            for (int i = 0; i < imgs.Count; i++)            {
  
                  ae.AddFrame(Image.FromFile(imgs[i]));            }            ae.Finish();

关注我,不失联。有啥问题请留言。

感情恋爱合集https://blog.csdn.net/forever8341/category_12863789.html

职业发展故事https://blog.csdn.net/forever8341/category_12863790.html

常用代码片段https://blog.csdn.net/forever8341/category_12863793.html

程序开发教程https://blog.csdn.net/forever8341/category_12863792.html

自我备考经验 https://blog.csdn.net/forever8341/category_12863791.html

高阶高效代码https://blog.csdn.net/forever8341/category_12873345.html

金融语言解析https://blog.csdn.net/forever8341/category_12877262.html

你可能感兴趣的:(常用代码片段,c#,开发语言)