public static void GetBitmapDimentions(IntPtr ipd, out int width, out int height) {
// get the info about the HBITMAP inside the IPictureDisp
var dibsection = new DIBSECTION();
var res = GetObjectDIBSection(ipd, Marshal.SizeOf(dibsection), ref dibsection);
width = dibsection.dsBm.bmWidth;
height = dibsection.dsBm.bmHeight;
}