Skip to main content

Images

Inline images​

Images are inline by default and flow with the text:

<paragraph>
<image src="data:image/png;base64,iVBOR..." width={914400} height={914400} />
</paragraph>

Dimensions are specified in EMUs (English Metric Units). 914400 EMU = 1 inch.

Convenience size props​

Use widthPt and heightPt for point-based sizing:

<image src="data:image/png;base64,..." widthPt={144} heightPt={144} />

Data URIs​

The src prop accepts base64-encoded data URIs:

import { readFileSync } from "node:fs";

const imageData = readFileSync("logo.png");
const base64 = imageData.toString("base64");
const src = `data:image/png;base64,${base64}`;

<image src={src} widthPt={72} heightPt={72} altText="Company logo" />

Supported formats​

Formatformat value
PNG"png"
JPEG"jpeg"
GIF"gif"
BMP"bmp"
SVG"svg"

The format is typically auto-detected from the data URI MIME type. Use the format prop to specify it explicitly if needed.

Floating images​

Set floating to position the image relative to the page:

<image
src={src}
widthPt={200}
heightPt={150}
floating
wrapText="square"
floatPosition={{
horizontalPosition: {
relative: "column",
offset: 457200, // EMUs from left
},
verticalPosition: {
relative: "paragraph",
offset: 0,
},
}}
/>

Wrap modes​

ValueDescription
"square"Text wraps in a rectangle around the image
"tight"Text wraps tightly to the image shape
"through"Text flows through transparent areas
"topAndBottom"Text above and below only
"behind"Image behind text
"inFront"Image in front of text

Image props reference​

PropTypeDescription
srcstringRequired. Data URI or file path
widthnumberWidth in EMUs
heightnumberHeight in EMUs
widthPtnumberWidth in points
heightPtnumberHeight in points
altTextstringAccessibility alt text
floatingbooleanEnable floating layout
wrapTextWrapTextText wrapping mode
floatPositionFloatingPositionPositioning details
formatstringImage format hint