Home/ Reference/ Bitmap

bitmap.SizeWidth / SizeHeight

The bitmap's size in pixels, not document size. This is how you tell whether an image is big enough — don't mistake shape.SizeWidth for a pixel count.

Signature

bitmap.SizeWidth / SizeHeight

Notes

The bitmap's size in pixels, not document size. This is how you tell whether an image is big enough — don't mistake shape.SizeWidth for a pixel count.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
shape = app.ActiveSelectionRange(1)

if shape.Type == 5:
    bmp = shape.Bitmap
    px_w, px_h = bmp.SizeWidth, bmp.SizeHeight

    # work out printable size from 300dpi (inches to mm)
    mm_w = px_w / bmp.ResolutionX * 25.4
    mm_h = px_h / bmp.ResolutionY * 25.4
    print("pixels: ", px_w, "x", px_h)
    print("Printable at 300dpi: ", round(mm_w, 1), "x", round(mm_h, 1), "mm")

About this section: Bitmap

Bitmap — raster image handling.

Other entries in this section