image.harmonize
Match a pasted subject's light and colour to its scene: a Reinhard colour transfer in CIELAB moves the subject's mean and spread toward the scene's, weighted by the subject mask, at strength 0..100 (default 60). Pixels outside the mask never change. Pass the composite plus a subject mask (white = subject, black = scene). Free: runs on the platform's own deterministic kernel, so the same input and arguments always return the same pixels. Takes PNG, JPEG, WebP, GIF or HEIC. Returns JSON {images:[{url, asset_key, download_url?, width, height}], price, next} plus a preview; images are stored in this workspace. Refuses: SIMPLER_MEDIA_INPUT_MISSING (pass the url or the asset_key), SIMPLER_MEDIA_FOREIGN_KEY (use this workspace's asset_key), SIMPLER_MEDIA_URL_REFUSED (use https, data:image or an asset_key), SIMPLER_MEDIA_PIN_TOO_LARGE (under 20MB), SIMPLER_EDIT_HARMONIZE_MASK_EMPTY (the mask selects no visible pixel: paint the subject white), SIMPLER_EDIT_HARMONIZE_NO_BACKGROUND (the mask covers everything: pass the whole composite with only the subject white), SIMPLER_EDIT_SERVER_PIXELS_NEEDS_PNG (the file is not an image: send a PNG, JPEG, WebP, GIF or HEIC), SIMPLER_EDIT_SERVER_PIXELS_TOO_LARGE (at most 4,194,304 pixels: run image.convert with width and height 2048 first), SIMPLER_IMAGES_BINDING_ABSENT (this deployment has no Images binding yet, owner step O-2: send a standard PNG), SIMPLER_IMAGES_QUOTA_EXCEEDED or SIMPLER_IMAGES_LEGACY_SUBSCRIPTION (an owner account step: send a standard PNG meanwhile), SIMPLER_IMAGES_INPUT_UNREADABLE (send a PNG, JPEG, WebP, GIF or HEIC), SIMPLER_IMAGES_INPUT_TOO_LARGE (under 20,000,000 bytes and 100 megapixels), SIMPLER_IMAGES_TRANSFORM_FAILED (retry, or send a standard PNG); nothing is charged on any of them, and INSUFFICIENT_CREDITS or PAYMENT_REQUIRED only when the workspace is already overdrawn or past its spend cap (add credits or raise the cap). NEXT: pass images[0].asset_key as image_asset_key to the next image.* tool, or open download_url when the result carries one.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| strength | No | How far to move the subject toward the scene, 0..100 (default 60). | |
| image_url | No | Composite image: a public https URL, a data:image/...;base64 URL, or the url/url_path of an earlier image result (max 20MB; PNG, JPEG, WebP or GIF; SVG is refused). Pass this or the matching *_asset_key, not both. | |
| request_ref | No | Optional idempotency key (1-64 chars: letters, digits, . _ : -). Retrying with the same request_ref and the same arguments within 24 hours returns the first result at $0 with replayed: true; the same request_ref with different arguments is refused (SIMPLER_IMAGE_REQUEST_REF_CONFLICT), and so is a retry whose first result was deleted since (SIMPLER_IMAGE_REQUEST_REF_RESULT_DELETED): send a new request_ref to run it again. | |
| preview_format | No | Preview block after the JSON, at most 384px on the long edge and never charged: png, jpeg or none. Left out, a PNG result gets a png preview and a JPEG or WebP result a jpeg one. A result with no preview says why in preview_unavailable. | |
| image_asset_key | No | Composite image, as the asset_key of an earlier image result for this workspace (edit-projects/<tenant>/... or images/<tenant>/...). A key from another workspace is refused (SIMPLER_MEDIA_FOREIGN_KEY). | |
| subject_mask_url | No | Subject mask (white = subject): a public https URL, a data:image/...;base64 URL, or the url/url_path of an earlier image result (max 20MB; PNG, JPEG, WebP or GIF; SVG is refused). Pass this or the matching *_asset_key, not both. | |
| subject_mask_asset_key | No | Subject mask (white = subject), as the asset_key of an earlier image result for this workspace (edit-projects/<tenant>/... or images/<tenant>/...). A key from another workspace is refused (SIMPLER_MEDIA_FOREIGN_KEY). |