eWolf eWolf - 3 months ago 35
C# Question

Pixel size of ImageSource

How can I determine the size of an ImageSource in pixels? The ImageSource object has a Height and a Width property, but they return the size in 1/96 inches..

Answer

You have to multiply the value with Windows's DPI resolution in order to obtain the amount of physical pixels. One way to get the DPI resolution is to get hold of a Graphics object and read its DpiX and DpiY properties.