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.