pptx_add_image
Place an image on a PowerPoint slide at given coordinates. Provide width, height, or let the tool preserve aspect ratio.
Instructions
Add an image to a slide at the given inch coordinates.
The w / h arguments control the rendered size:
Both given — the picture is stretched to exactly those dimensions (
VAL-PPTX-036).Only
wgiven —his computed from the image's intrinsic aspect ratio (VAL-PPTX-038). Aspect ratio preserved within 1% tolerance.Only
hgiven —wis computed from the image's intrinsic aspect ratio (VAL-PPTX-039).Neither given — the picture is rendered at its natural pixel size at 96 DPI (
VAL-PPTX-037).
Args:
path: Path to an existing .pptx.
image_path: Path to the image to embed (any format python-pptx
can read: PNG, JPEG, GIF, BMP, TIFF).
x: Left edge in inches.
y: Top edge in inches.
w: Optional width in inches. None = compute from aspect
ratio (when h is given) or use natural size.
h: Optional height in inches. None = compute from aspect
ratio (when w is given) or use natural size.
slide: 0-based slide index.
folder: Optional base folder for relative paths. Used for
both the deck and the image path.
Returns:
{"shape_index": <int>} — 0-based index of the new picture
within the slide's shape list.
Raises:
OfficeMCPError: ERR_FILE_NOT_FOUND if either the deck
or the image file is missing (VAL-PPTX-040);
ERR_INVALID_PARAMS for out-of-range slide
(VAL-PPTX-041) or non-numeric geometry; ERR_UNSUPPORTED_FMT
for non-.pptx extensions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| image_path | Yes | ||
| x | Yes | ||
| y | Yes | ||
| w | No | ||
| h | No | ||
| slide | No | ||
| folder | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||