ImageType enumeration

ImageType enumeration

Specifies the type (format) of an image in a Microsoft Word document.


NO_IMAGEThe is no image data.
UNKNOWNAn unknown image type or image type that cannot be directly stored inside a Microsoft Word document.
EMFWindows Enhanced Metafile.
WMFWindows Metafile.
PICTMacintosh PICT. An existing image will be preserved in a document, but inserting new PICT images into a document is not supported.
PNGPortable Network Graphics.
BMPWindows Bitmap.


Shows how to add an image to a shape and check its type.

doc = aw.Document()
builder = aw.DocumentBuilder(doc)

with open(IMAGE_DIR + "Logo.jpg", "rb") as stream:

    image = drawing.Image.from_stream(stream)

    # The image in the URL is a .gif. Inserting it into a document converts it into a .png.
    img_shape = builder.insert_image(image)
    self.assertEqual(aw.drawing.ImageType.JPEG, img_shape.image_data.image_type)

See Also