
ImageKit conditions can inspect either the current image at that chain step or the original untransformed image. Use w, h and ar for the current state; use iw, ih and iar for the original. An earlier crop can therefore change a branch that was intended to classify the source photograph.
Key Takeaways
- The property name determines which geometry the condition reads.
- A conditional block needs its own chain step.
- Test the intended branch and the resulting picture separately.
State the branch question precisely
Official ImageKit conditional-transformation reference defines width, height and aspect-ratio properties for the current step, and separate properties for the original image. It documents the block form:
if-{condition},{true transforms},if-else,{false transforms},if-end
A condition asking “was the source landscape?” needs original aspect ratio. A condition asking “is the canvas currently landscape after the crop?” needs current aspect ratio. Those questions can have different answers for the same request.
Build a branch matrix before editing the URL
- Record the original file's width, height and aspect ratio.
- Write down every geometry-changing step before the condition.
- Decide whether the branch depends on original or current geometry.
- Select the corresponding documented property.
- Put the conditional block in its own colon-separated chain step.
- Review both true and false inputs, including a boundary case.
The documentation says a step containing an if block cannot contain unrelated comma-separated transformations outside that block. Fix invalid grouping before interpreting a response as the wrong branch. It also says conditional transformations are not supported for GIF files.
A hypothetical landscape source with a square crop
An imagined source is 1200 by 800 pixels. Its original aspect ratio is 1.5. A deliberate earlier square crop makes the current aspect ratio 1. A later condition using ar_gt_1 therefore asks a different question from one using iar_gt_1.
These are illustrative geometry values, not a request executed against ImageKit. The acceptance worksheet should state which branch each input is expected to take and which final dimensions or crop will reveal that route.
Check the branch without confusing approval
A geometry branch cannot recognize whether the face is intact or the product is correct. Inspect those editorial requirements after confirming the processing path. Retain the full chain with the approved file so future revisions do not silently move a crop ahead of the condition.
The Photoshop conditional-action guide warns that earlier edits can change a tested property. This provider adds an explicit choice between current-state and original-state properties within the same chain. Accept when that choice matches the written rule and both branch outputs pass their intended visual review.
Related tasks
- How Can One Photoshop Action Handle Square and Non-Square Images Differently?
- How Do I Crop a Set of Portraits Consistently When Everyone Is a Different Height?
- Why Is My Website Slow After I Upload Full-Size AI Images Everywhere?
Sources and scope
- ImageKit: Conditional transformations: Current-step w/h/ar versus original iw/ih/iar properties; if/else/end syntax, dedicated chain step requirement and GIF exclusion.
Documentation-based editorial guidance. All scenarios, worksheets and acceptance checks are hypothetical or proposed. No hands-on test, account operation, benchmark, measured search demand, AI-citation rate or platform acceptance is claimed.
Prepared by Imagild Editorial, the company editorial team responsible for these guides. AI assisted research and drafting. This is documentation-based guidance with proposed examples, not a claim of hands-on testing or an independent product review. Report a correction.
Cover: AI-generated conceptual editorial illustration; not a real application screenshot, observed output or before-and-after test.