transformation-builder
Original:🇺🇸 English
Translated
Guidance for building ImageKit image/video transformation URLs with the transformation_builder tool — how the tool works, how to write a good query, how to order multi-step chains, and a reference of every supported parameter. Use before calling transformation_builder. Covers resize/crop/focus, AI edits (change objects, colors, styles), background removal/replacement, generative fill, upscaling, retouching, drop shadows, variations, effects (blur/sharpen/rotate/border/color-replace/gradient), image/text/video overlays, and video transforms.
1installs
Added on
NPX Install
npx skill4agent add imagekit-developer/skills transformation-builderTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Transformation Builder Skill
Understand how the tool works, write a precise query, order multi-step chains correctly, then call .
transformation_builderHow this tool actually works (read this first)
transformation_buildertransformation_builder(query, src?, previous_errors?)- — a natural-language description of the desired transformation.
query - — optional ImageKit-hosted source URL (defaults to a sample image).
src - — pass the error text from a prior failed call so the tool can self-correct.
previous_errors
Internally the tool: (1) searches ImageKit docs using your , (2) an LLM turns it into a validated list of transformation steps, (3) the SDK builds the final URL. There is no argument — the parameter names below are vocabulary to put into your query, not API fields you set directly. Because step 1 is a doc search over your query text, using the correct ImageKit parameter names and values in the query materially improves the result. Using wrong/invented names sends the search off course.
querycapabilitySo your job is: translate the user's vague request into a precise query that references real parameters and values from the reference section below.
When to use (triggers this skill)
- Resize, crop, or focus on a region
- Filters, effects, overlays (image/text/video), watermarks
- Multi-step transformation chains
- Background removal, replacement, or generative fill
- Any AI-powered image editing (change objects/colors/styles, upscale, retouch, drop shadow, variations)
Calling transformation_builder
transformation_builder- : the precise, rewritten description (see Query Crafting). Never pass the user's vague words through unchanged.
query - : the ImageKit delivery URL to transform, if the user gave one. Must be ImageKit-hosted.
src - Frame a multi-step request as one query describing the steps in order:
- User: "1) Resize to 800x600 2) Crop to the face"
- Query: "Resize to width 800 and height 600, then crop with focus on the face"
Query Crafting
Rule: rewrite the vague request into a description that names real parameters and values. Use exact parameter names/values when you know them; fall back to plain English only when unsure.
| User says | Weak query | Good query |
|---|---|---|
| "Make the red balls green" | "make red balls green" | "Apply an AI edit ( |
| "Clean it up and put it on white" | "clean up, white background" | "Apply |
| "Make it look like a painting" | "painting style" | "Apply |
| "Crop around the face" | "crop face" | "Resize with |
| "Text 'Hello' at the bottom" | "add hello text" | "Add a text overlay with text 'Hello', positioned at the bottom ( |
| "Fit a mobile banner" | "mobile banner" | "Resize to |
| "300px wide with a red border" | "resize and border" | "Resize to |
| "Higher resolution, it's blurry" | "fix quality" | "Apply |
| "Remove bg and add a shadow" | "remove bg shadow" | "Apply |
| "Make it wider without stretching" | "make wider" | "Extend the canvas horizontally using a padded crop ( |
Intent → real parameter/vocabulary
Use this to translate intent into the correct terms to put in the query. These are the actual parameter names the tool validates against.
| User intent | Use this vocabulary | Notes |
|---|---|---|
| Modify specific objects/regions ("enlarge the cat", "add sunglasses", "make it a painting") | | AI content edit driven by a text prompt |
| Replace the whole background scene ("put them on a beach") | | Keeps the subject, generates a new scene. Not for plain removal or color changes |
| Remove background → transparent | | ImageKit-native. For the external remove.bg engine use |
| Extend/outpaint the canvas ("add more sky", "make it panoramic") | padded crop + | Generative fill lives in the background param, not a standalone AI field. Takes no prompt |
| Increase resolution / fix low-res | | Boolean; no params |
| Clean up / remove blemishes | | Boolean; no params |
| Realistic shadow under a cut-out subject | | Transparent images only. Optional |
| Different version / remix | | Boolean; preserves structure |
| Resize / aspect ratio / crop | | See Resize & Crop table |
| Smart crop to face/object | | Object names are COCO classes ( |
| Swap one color across all pixels ("all red → blue") | | Global pixel color swap with |
| Filters/adjustments (B&W, blur, sharpen, rotate, border, round corners) | | See Effects table |
| Overlay a logo/watermark image | text/image overlay | Single |
| Write text on the image | text overlay with | See Overlays |
There is no "generate an image from scratch" step in this tool — it always transforms an existing. To generate images from scratch, use text-to-image generation in the ImageKit DAM (Digital Asset Manager), which is a separate feature fromsrc.transformation_builder
Key distinction: ai_edit
vs color_replace
vs ai_change_background
ai_editcolor_replaceai_change_background- Changing specific objects/regions ("make the balls bigger", "turn the car red") →
ai_edit - Swapping one color globally across all pixels ("replace all red with blue") →
color_replace - Replacing the entire background scene ("put them on a beach") →
ai_change_background
Ordering multi-step chains
When a request spans multiple operations, chain them in one query in this order:
- Upscale / retouch (quality first)
- AI content edits ()
ai_edit - Background removal / replacement (,
ai_remove_background)ai_change_background - Resize / crop (final dimensions)
- Effects / overlays (finishing touches)
Critical: background removal goes AFTER upscale/retouch, never before.
Correct: . Wrong: .
ai_upscale → ai_remove_backgroundai_remove_background → ai_upscaleExample — "clean up this photo, remove the background, make it 500x500":
→ Query: "Apply , then , then resize to =500 and =500".
ai_retouchai_remove_backgroundwidthheightBackground removal: clarify intent
- If the user says "remove background" ambiguously, ask whether they want:
- Real-time URL — in a delivery URL (nothing stored).
ai_remove_background - Remove and save — apply the background-removal extension and upload the result as a new file version (a media-library operation, not this tool).
- Real-time URL —
- Only use when they want a new background scene. For a plain transparent cut-out or a solid color, use
ai_change_background(optionally followed byai_remove_background=a color).background
Handling failures
- 400 / Bad Request or validation error: refine the query and retry, passing the error text as . Invoke the
previous_errorsskill and callsearch-docsto confirm supported parameters/limits.search_docs - 3+ failures: use to find supported methods and constraints before retrying.
search-docs - Unsupported: confirm via docs and offer the closest supported alternative.
Gotchas
- Source URL must be ImageKit-hosted.
- Background removal order matters (upscale/retouch first).
- Generative fill = =
backgroundon a padded/enlarged canvas; it takes no prompt.genfillis the prompt-driven one.ai_change_background - needs a transparent subject (run
ai_drop_shadowfirst).ai_remove_background - Negative offsets/rotation are written with an prefix in the final URL (the tool handles this) — just describe the value normally.
N
Parameter reference
These are the real names/values the tool validates. Put them into your query.
Resize & crop
| Parameter | What it does |
|---|---|
| Output width. Integer px, decimal 0–1 (fraction of original), or an arithmetic expression. |
| Output height. Same formats as |
| Aspect ratio (e.g. |
| Resize strategy: |
| Pad/extract behavior: |
| Focal point: |
| Zoom factor around the focused area (with face/object focus). |
| Region coordinates for |
| Device pixel ratio (number or |
| Fill for padded areas — see Background modes. |
Background modes (background
)
background| Value | Meaning |
|---|---|
| a color | Hex ( |
| Blurred version of the image (optionally |
| The image's dominant color. |
| AI generative fill of the padded area (outpainting). No prompt. |
| Gradient from dominant colors ( |
AI transforms
| Parameter | What it does |
|---|---|
| ImageKit-native background removal → transparent. |
| Background removal via external provider (remove.bg). |
| Prompt-based AI edit of image content. |
| Prompt-based replacement of the background scene (subject preserved). |
| AI drop shadow (transparent images only). Optional |
| AI super-resolution upscaling. No params. |
| AI quality enhancement / blemish removal. No params. |
| Generate a structural variation of the image. No params. |
Effects & enhancement
| Parameter | What it does |
|---|---|
| Gaussian blur, 0–100. |
| Sharpen, 0–100. |
| Advanced sharpening ( |
| Convert to grayscale. |
| Auto-enhance contrast. |
| Drop shadow under non-transparent pixels (needs transparency). Optional |
| Linear gradient overlay ( |
| Replace a color and similar shades: |
| Tint the image: |
| Border of |
| Trim solid edges around the subject. |
| Rotate by degrees (or |
| |
| Round corners (integer, |
| Layer opacity, 0–100. |
| Perspective warp (4 coordinate pairs) or arc distortion (degrees). |
Overlays (overlay
)
overlayOne concept with a typed shape. Each overlay supports (, , , , , ), for video (, , ), (, , , ), and a nested list.
overlaypositionxyx_centery_centerfocusanchor_pointtimingstartenddurationlayer_modemultiplycuttercutoutdisplacetransformation| Overlay type | Key fields |
|---|---|
| Text | |
| Image | |
| Video | |
| Subtitle | |
| Solid color | |
Video transforms
| Parameter | What it does |
|---|---|
| Trim the clip (seconds or arithmetic expressions). |
| |
| |
| Adaptive-bitrate ladder, e.g. |
| Same as image effects, applied to the video frame. |
Output & delivery
| Parameter | What it does |
|---|---|
| |
| 0–100. |
| Progressive JPEG. |
| Lossless WebP/PNG. |
| Apply a saved named transformation. |
| Fallback image if the source is missing. |
Conditionals
Transformations can be conditional on image properties (e.g. width/height/aspect ratio) — describe the condition in plain language ("if width > 1000, then …") and the tool builds the // chain.
ifif-elseif-end