public void UpdateInformations() { try { _Informations.Clear(); _Informations.Add(new Models.InformationModel("Frame Dimensions", string.Format("{0}x{1}", new object[] { Preview.PixelWidth.ToString(), Preview.PixelHeight.ToString() }))); long frameSize; if (SelectedFrame.Size.Width == 256) { System.IO.MemoryStream mem = new System.IO.MemoryStream(); PngBitmapEncoder encoder = new PngBitmapEncoder(); encoder.Frames.Add(System.Windows.Media.Imaging.BitmapFrame.Create(SelectedFrame.Frame)); encoder.Save(mem); frameSize = mem.Length; encoder = null; mem.Close(); } else { System.IO.MemoryStream mem = new System.IO.MemoryStream(); BmpBitmapEncoder encoder = new BmpBitmapEncoder(); encoder.Frames.Add(System.Windows.Media.Imaging.BitmapFrame.Create(SelectedFrame.Frame)); encoder.Save(mem); frameSize = mem.Length; encoder = null; mem.Close(); } frameSize = (long)Math.Round((double)(frameSize / 1000)); _Informations.Add(new Models.InformationModel("Frame Physical Size", frameSize.ToString() + " KB")); _Informations.Add(new Models.InformationModel("Frame Color Depth", Preview.Format.BitsPerPixel.ToString() + "BPP")); _Informations.Add(new Models.InformationModel("Frame Decoder", (SelectedFrame.Type == Models.IconFrameModelType.PNG) ? "WIC PNG" : "WIC BMP")); _Informations.Add(new Models.InformationModel("Icon Size", string.Format("{0}x{1}", new object[] { Frames.Biggest().Size.Width, Frames.Biggest().Size.Width }))); long iconsize; System.IO.MemoryStream iconmem = new System.IO.MemoryStream(); bool canCompress = Frames.Where(x => x.Type == Models.IconFrameModelType.PNG).ToArray().Length > 0; SaveIcon(iconmem, canCompress); iconsize = (long)Math.Round((double)(iconmem.Length / 1000)); iconmem.Close(); _Informations.Add(new Models.InformationModel("Extimated file size", iconsize.ToString() + " KB")); GC.Collect(); } catch { } }