The printing GraphicsUnit is Display, which is 1/100th inch, while the image unit is Pixel. Convert the image measurements to Display units, then you can do the logic math with comparable values. Example:
Dim img As Image = Image.FromFile("img.bmp")
'image size in 1/100 inch measurement
Dim sz As New SizeF(100 * img.Width / img.HorizontalResolution, _
100 * img.Height / img.VerticalResolution)
Dim p As New PointF((e.PageBounds.Width - sz.Width) / 2, _
(e.PageBounds.Height - sz.Height) / 2)
Good! Here's a short explanation of the measurement systems and the conversion that was done. As mentioned image unit is Pixel, the resolution (HorizontalResolution, VerticalResolution) says how many pixels there is per inch, for display devices also called PPI (pixels per inch), so the relation between these give the inch measurement. Since the numbers in PageBounds/MarginBounds is in scale 1:100 we have to multiply the image sizes by 100 to get values in same scale.
DPI relates to PPI by 1:1 for display devices, a printer can have higher resolution and use multiple ink dots per pixel.
For example page width can be 827, which is 8.27in. An image of 400x400 at 150dpi/ppi is 2.67in. wide. The values that is compared in PrintPage handler here would be 827 and 267, and the X value of the point would be (827-267)/2=280.