public static Gif DecodeParallelExample() { var bytes = File.ReadAllBytes(Path); var stopwatch = new Stopwatch(); stopwatch.Start(); var decodeProgress = new DecodeProgress(); Gif.DecodeParallel(bytes, progress => { Console.WriteLine("Decode progress: {0}/{1}", progress.Progress, progress.FrameCount); decodeProgress = progress; }); while (decodeProgress.Exception == null && !decodeProgress.Completed) { Thread.Sleep(100); } if (decodeProgress.Exception != null) { throw decodeProgress.Exception; } stopwatch.Stop(); var gif = decodeProgress.Gif; if (gif != null) { Console.WriteLine("GIF decoded in {0:n2}s, size: {1}x{2}, frames: {3}.", stopwatch.Elapsed.TotalSeconds, gif.Frames[0].Texture.width, gif.Frames[0].Texture.height, gif.Frames.Count); } return(gif); }