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..
+3
A:
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.
Tormod Fjeldskår
2009-07-18 09:40:02
+2
A:
There are 2 types of ImageSource: DrawingImage and BitmapSource.
Obviously, DrawingImage does not have DPI or pixel width, because it's essentially vector graphic.
On other side, BitmapSource has PixeWidth/PixelHeight and also DpiX/DpiY.
http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.bitmapsource.pixelheight.aspx
Oleg Mihailik
2009-07-19 20:08:49