Reputation: 393
Our application has rendering logic that depends on the horizontal / vertical image resolutions in dots per inch.
This used to be available as DpiX and DpiY properties in the WriteableBitmap / BitmapSource classes: https://msdn.microsoft.com/en-us/library/system.windows.media.imaging.writeablebitmap.aspx
For UWP, it's gone: https://msdn.microsoft.com/library/windows/apps/br243259
Do the properties exist somewhere else now or are they totally gone?
Upvotes: 1
Views: 414
Reputation: 10627
For UWP, the properties exist in BitmapDecoder class now. Here is a simple code sample about getting DPI information by using this class:
var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/HelloWorld.png"));
using (IRandomAccessStream stream = await file.OpenReadAsync())
{
BitmapDecoder decoder = await BitmapDecoder.CreateAsync(BitmapDecoder.PngDecoderId, stream);
var DpiX = decoder.DpiX;
var DpiY = decoder.DpiY;
}
Upvotes: 3