Aspose::Words::Drawing::ImageType enum

ImageType enum

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

enum class ImageType

Values

NameValueDescription
NoImage0The is no image data.
Unknown1An unknown image type or image type that cannot be directly stored inside a Microsoft Word document.
Emf2Windows Enhanced Metafile.
Wmf3Windows Metafile.
Pict4Macintosh PICT. An existing image will be preserved in a document, but inserting new PICT images into a document is not supported.
Jpeg5JPEG JFIF.
Png6Portable Network Graphics.
Bmp7Windows Bitmap.
Eps8Encapsulated PostScript.
WebP9
Gif10

Examples

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

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);

ArrayPtr<uint8_t> imageBytes = System::IO::File::ReadAllBytes(ImageDir + u"Logo.jpg");

{
    auto stream = MakeObject<System::IO::MemoryStream>(imageBytes);
    SharedPtr<System::Drawing::Image> image = System::Drawing::Image::FromStream(stream);

    // The image in the URL is a .gif. Inserting it into a document converts it into a .png.
    SharedPtr<Shape> imgShape = builder->InsertImage(image);
    ASSERT_EQ(ImageType::Jpeg, imgShape->get_ImageData()->get_ImageType());
}

See Also