private Stream GetResizedImage(Stream originalStream, ImageSize size, string fileName) { BitmapFrame frame = ImageHelper.ReadBitmapFrame(originalStream); BitmapFrame resizedFrame = frame.ResizeImage(size.Width, size.Height); if (Settings.UseLocalCache) { string name = ResolveFileName(fileName, size.ToString()); resizedFrame.SaveToFile(name); return(OpenImageStream(name)); } return(resizedFrame.GetStream()); }