MMetadata /docs
Docs/Tools/resize_image

resize_image

Make a resized copy of an image at an exact pixel size.

Writes creative

Creates or changes something in the account. Put it behind whatever review your agent uses.

What it does

Make a resized copy of an image at an exact pixel size. Deterministic image processing: no AI model runs and nothing in the image is redrawn.

USE FOR: fitting an existing image (an uploaded file, a library creative, a creative made earlier) to a placement's size, e.g. LinkedIn 1200x628 or 1200x1200, Meta feed 1080x1080 or 1440x1800, Stories 1080x1920, display 300x250 or 728x90.

SIZE: give width and height for an exact size, or only one of them to scale proportionally. Each side is at most 4096 px.

WHEN THE SHAPE CHANGES (width and height given, in an aspect ratio other than the source's), `fit` decides:
- pad (default): keeps the whole image, scaled to fit inside the target, and fills the empty bands with `background`. Nothing is cut off or distorted.
- crop: scales the image to cover the target and trims the overflow, keeping the part named by `crop_focus`. WARNING: text, logos or faces near the trimmed edges are lost.
- stretch: scales each side independently. Distorts the image; use it only when asked to.
A source within 1% of the target's shape is scaled straight to the exact size.

DOES NOT: redesign or re-lay out a creative for a new shape, change the source image, or save anything to the creatives library.

OUTPUT: the URL of a NEW image (`s3_url`), stored temporarily outside the creatives library, with its `image_size`, the source's `source_size`, `fit_applied` (none when the shape was kept), the pad's `background`, `upscaled` (true when the source was enlarged, which cannot add detail and looks softer) and `format`. To use it in an ad, upload the URL with upload_image_creative, which gives it a NEW library id.

Arguments

ArgumentTypeNotes
image_source string required URL of the image to resize: a public http(s) URL of a PNG, JPEG, WebP, GIF, BMP or TIFF image (an animation gives its first frame), such as an uploaded file, a library creative's URL, or a URL returned by an earlier creative tool. At most 25 MB and 25 megapixels; a larger JPEG is accepted when the t
width integer Target width in pixels. Omit it to scale proportionally from `height`.
height integer Target height in pixels. Omit it to scale proportionally from `width`.
fit string How to reach a target of another shape: pad, crop or stretch, as the tool description explains. Ignored when only one side is given.
one of: pad, crop, stretch
background string What fills the bands `pad` adds: 'auto' (the image's own edges extended into the bands, row by row beside it or column by column above and below, so the seam shows no jump: a plain background continues as one flat color and a gradient as itself; transparent edges stay transparent), 'blur' (a blurred
crop_focus string The part of the image `crop` keeps. Ignored by pad and stretch.
one of: center, top, bottom, left, right
output_format string 'auto' keeps a JPEG source as JPEG and writes PNG otherwise, switching to JPEG when an opaque PNG would pass 5 MB, the image limit of most ad channels. 'png' keeps transparency; 'jpeg' puts transparent areas on white.
one of: auto, png, jpeg

Request

Request template, not a complete runnable example. Replace placeholders, empty objects, arrays, and zero values with valid account-specific inputs. Read required fields and nested constraints in the full schema. Confirm the account, connected channels, and referenced assets before calling a write tool.

curl
curl -s -X POST https://mcp-server.metadata.io/mcp \
  -H "Authorization: $METADATA_PAT" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "MCP-Protocol-Version: 2025-11-25" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"resize_image","arguments":{"image_source":"<image_source>"}}}'

Response

No recorded response. This tool writes to the account, so it is never executed to build these docs. The request is an illustrative template. Fill required fields and check the current schema before calling it. No response is fabricated.

Other creative tools:

Browse the tool catalog · machine-readable index