static void MakeAnimGif() { using (FileStream fs = File.OpenWrite(@"anim.gif")) { GD host = CreateGifFrame(0); host.GifAnimBegin(fs); GD prev = null; for (int i = 0; i < 20; i++) { GD frame = CreateGifFrame(i); frame.GifAnimAdd(fs, 0, 0, 0, 2, GD.Disposal.None, prev); //frame.Save("frame" + i + ".gif"); //frame.Save(GD.FileType.Png, "frame" + i + ".png", 1); prev = frame; } host.GifAnimEnd(fs); fs.Close(); } }
private void onClickExtractAnimatedAnimation(object sender, EventArgs e) { string path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; string gif = Path.Combine(path, "Dress Anim.gif"); string temp = Path.Combine(path, "temp.png"); using (FileStream fs = File.OpenWrite(gif)) { m_Animation[0].Save(temp, ImageFormat.Png); using (GD host = new GD(GD.FileType.Png, temp)) { host.GifAnimBegin(fs); GD prev = null; for (int i = 0; i < m_Animation.Length; ++i) { m_Animation[i].Save(temp, ImageFormat.Png); GD frame = new GD(GD.FileType.Png, temp); frame.GifAnimAdd(fs, 1, 0, 0, 15, GD.Disposal.None, prev); prev = frame; } File.Delete(temp); host.GifAnimEnd(fs); } fs.Close(); } MessageBox.Show( String.Format("InGame Anim saved to '{0}'", gif), "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); }