Replace an image
replace_imageReplace an existing image in a Google Doc with a new image from a public URL, preserving the original size and position.
Instructions
Replaces an existing image's contents with a new image from a public URL, keeping the original's size and position (the new image is center-cropped to fit). image_object_id is the inline object id — read_document_text shows it inside [image:] placeholders, and get_document lists all ids under inlineObjects. The same URL rules as insert_image apply (public, <=50 MB, <=25 MP, PNG/JPEG/GIF).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uri | Yes | Public URL of the new image. | |
| tab_id | No | Tab to target (from list_tabs). Omit for the first/only tab. | |
| document_id | Yes | The document id — the long id from the document URL (docs.google.com/document/d/<documentId>/edit) or from create_document output. | |
| image_object_id | Yes | The image's object id (from read_document_text [image:...] or get_document inlineObjects). |