This project is read-only.


It would appear that the resolution parameter of the SaveAsImage() method simply multiplies the width and height to produce a scaled image. If you notice the Resolution property in the screenshots below, it is always 1.4986 x 1.4986 pixels per inch (ppi) but the Size in pixels changed.

resolution: 1.0 resolution: 1.1
colorDepth: 24 colorDepth: 24
width: 432 width: 432
height: 575 height: 575
ImageProperties_1.png ImageProperties_2.png

If we take a screenshot of the same window using SaveAsImageUsingBitBlt(), we can see quite a difference in the image properties. Specifically, the Size in pixels is exactly the window client size but also notice that the Resolution is 96.012 x 96.012 pixels per inch (ppi).
Regarding Window.UsableHeight and Window.UsableWidth, the SDK tells us that they are always returned in points (1/72 inch). This explains why the SaveAsImageUsingBitBlt() method produces a differently sized image as it uses the Win32 method GetClientRect(). The following code tells us the system DPI.

using (System.Drawing.Graphics graphics = System.Drawing.Graphics.FromHwnd(IntPtr.Zero))
    //graphics.DpiX = 96.0
    //graphics.DpiY = 96.0

Thus, 96 \ 72 = 1.333333333333333.
432 (Window.UsableWidth) x 1.333333333333333 = 576 (GetClientRect).
575 (Window.UsableHeight) x 1.333333333333333 = 767 (GetClientRect).

colorDepth: 32
width: 576
height: 767

Last edited Mar 10, 2014 at 4:23 AM by jnewell, version 2