private void LoadMultiImage(FREE_IMAGE_FORMAT _FT, string path) { var _FMP = FreeImage.OpenMultiBitmap(_FT, path, false, true, true, FREE_IMAGE_LOAD_FLAGS.GIF_PLAYBACK); _FBMP = FreeImage.GetPageCount(_FMP); for (int i = 0; i < _FBMP; i++) { var _Page = FreeImage.LockPage(_FMP, i); if (_DefaultRate == 0) { FreeImage.GetMetadata(FREE_IMAGE_MDMODEL.FIMD_ANIMATION, _Page, "FrameTime", out FITAG _tag); _DefaultRate = Marshal.ReadInt32(FreeImage.GetTagValue(_tag)); //Console.WriteLine("Gif Rate :{0}",_DefaultRate); if (_DefaultRate == 0) { _DefaultRate = 80; } _FrameWidth = FreeImage.GetWidth(_Page); _FrameHeight = FreeImage.GetHeight(_Page); } var _BM = FreeImage.GetBitmap(_Page); var _SM = new MemoryStream(); _BM.Save(_SM, ImageFormat.Png); var _Image = new BitmapImage(); _Image.BeginInit(); _Image.CacheOption = BitmapCacheOption.OnLoad; _Image.StreamSource = _SM; _Image.EndInit(); _Image.Freeze(); List.Add(i, _Image); _SM.Dispose(); _BM.Dispose(); if (i == 0) { Dispatcher.BeginInvoke(new Action(() => { Source = _Image; })); } } FreeImage.CloseMultiBitmap(_FMP, FREE_IMAGE_SAVE_FLAGS.DEFAULT); }