public static void Main(string[] args) { // 33ms delay (~30fps) using (var gif = AnimatedGif.Create("gif.gif", 33)) { var img = Image.FromFile("img.png"); gif.AddFrame(img, delay: -1, quality: GifQuality.Bit8); } }
public static void Main(string[] args) { // 33ms delay (~30fps) using (var gif = AnimatedGif.Create("gif.gif", 33)) { var img1 = Image.FromFile("001.jpg"); gif.AddFrame(img1, delay: -1, quality: GifQuality.Bit8); var img2 = Image.FromFile("002.jpg"); gif.AddFrame(img2, delay: -1, quality: GifQuality.Bit8); var img3 = Image.FromFile("003.jpg"); gif.AddFrame(img3, delay: -1, quality: GifQuality.Bit8); } }
public static void WriteGif(int delay) { using var gif = AnimatedGif.Create("gif.gif", delay); var img1 = Image.FromFile("001.jpg"); gif.AddFrame(img1, delay: -1, quality: GifQuality.Bit8); var img2 = Image.FromFile("002.jpg"); gif.AddFrame(img2, delay: -1, quality: GifQuality.Bit8); var img3 = Image.FromFile("003.jpg"); gif.AddFrame(img3, delay: -1, quality: GifQuality.Bit8); }
public static void Main(string[] args) { string workingPath = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName; // 33ms delay (~30fps) using (var gif = AnimatedGif.Create(workingPath + "/test.gif", 33)) { var img = Image.FromFile(workingPath + "/forest.jpg"); gif.AddFrame(img, delay: -1, quality: GIFQuality.Bit8); } var animatedGif = new AnimatedGif(workingPath + "/samplegif.gif"); for (int i = 0; i < animatedGif.FrameCount; i++) { Console.WriteLine("Reading frame " + i); // Image gifImage = animatedGif.GetFrame(i); } }