Edit

Share via


Word.ImageFormat enum

Represents image format type.

Remarks

[ API set: WordApiDesktop 1.1 ]

Examples

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/15-images/insert-and-get-pictures.yaml

// Gets the first image in the document.
await Word.run(async (context) => {
  const firstPicture: Word.InlinePicture = context.document.body.inlinePictures.getFirst();
  firstPicture.load("width, height, imageFormat");

  await context.sync();
  console.log(`Image dimensions: ${firstPicture.width} x ${firstPicture.height}`, `Image format: ${firstPicture.imageFormat}`);
  // Get the image encoded as Base64.
  const base64 = firstPicture.getBase64ImageSrc();

  await context.sync();
  console.log(base64.value);
});

Fields

bmp = "Bmp"

Bitmap image format.

emf = "Emf"

Enhanced Metafile image format.

exif = "Exif"

Exif image format.

gif = "Gif"

GIF image format.

icon = "Icon"

Icon image format.

jpeg = "Jpeg"

JPEG image format.

pdf = "Pdf"

PDF image format.

pict = "Pict"

PICT image format.

png = "Png"

PNG image format.

svg = "Svg"

SVG image format.

tiff = "Tiff"

TIFF image format.

undefined = "Undefined"

Undefined image format.

unsupported = "Unsupported"

Unsupported image format.

wmf = "Wmf"

Windows Metafile image format.