Resize Image
resize_imageMake 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.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fit | No | How to reach a target of another shape: pad, crop or stretch, as the tool description explains. Ignored when only one side is given. | pad |
| width | No | Target width in pixels. Omit it to scale proportionally from `height`. | |
| height | No | Target height in pixels. Omit it to scale proportionally from `width`. | |
| background | No | 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, enlarged copy of the image), 'transparent', or a color such as '#FFFFFF'. Ignored by crop and stretch. | auto |
| crop_focus | No | The part of the image `crop` keeps. Ignored by pad and stretch. | center |
| image_source | Yes | 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 target is small enough to decode it at a reduced scale. | |
| output_format | No | '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. | auto |