In a WPF application, I get the image size (width and height) before loading it (since I load it with a reduced size ...), and I use this C # code to get it:
BitmapFrame frame = BitmapFrame.Create(new Uri(path), BitmapCreateOptions.DelayCreation, BitmapCacheOption.None); Size s = new Size(frame.PixelWidth, frame.PixelHeight);
This works fine, but then it blocks the image file, which I later want to delete with the application, but cannot. I know if I installed BitmapCacheOption.OnLoad, it solves the problem, but then it loads the image, so I lose the advantage I want by downloading it with a reduced size (using DecodePixelWidth, etc.).
So, does anyone know how to get the image size in advance without blocking the image?
source share