public void AddFrame(Image img, GIFQuality quality = GIFQuality.Default) { GifClass gif = new GifClass(); gif.LoadGifPicture(img, quality); if (frameNum == 0) { binaryWriter.Write(gif.m_ScreenDescriptor.ToArray()); } binaryWriter.Write(graphicControlExtensionBlock); binaryWriter.Write(gif.m_ImageDescriptor.ToArray()); binaryWriter.Write(gif.m_ColorTable.ToArray()); binaryWriter.Write(gif.m_ImageData.ToArray()); frameNum++; }
public void AddFrame(Image img, GIFQuality quality = GIFQuality.Default) { GifClass gif = new GifClass(); gif.LoadGifPicture(img, quality); if (stream == null) { stream = new FileStream(FilePath, FileMode.Create, FileAccess.Write, FileShare.Read); stream.Write(CreateHeaderBlock()); stream.Write(gif.m_ScreenDescriptor.ToArray()); stream.Write(CreateApplicationExtensionBlock(Repeat)); } stream.Write(CreateGraphicsControlExtensionBlock(Delay)); stream.Write(gif.m_ImageDescriptor.ToArray()); stream.Write(gif.m_ColorTable.ToArray()); stream.Write(gif.m_ImageData.ToArray()); FrameCount++; }