Description
Generate image and box sizes with delegated contain/cover geometry and reconstruct source crops from alignment or clamped source focal coordinates.
An interface fixture makes content and state explicit so a consumer can test a rendering or interaction. Literal labels, modeled states, and calculated geometry remain separate from what a browser or assistive technology actually displays or announces.
Generate image and box sizes with delegated contain/cover geometry and reconstruct source crops from alignment or clamped source focal coordinates.
When to use this tool
Use this generator to create reproducible object fit crop corpus cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.
How to use the tool and how it works
- Supply count, imageWidthPx, imageHeightPx, boxWidthPx, boxHeightPx, xPercent, yPercent, positionMode in the field shapes below. Set seed when you need an explicit replay.
- Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
- Read cases. Use the conventions below and keep answer-bearing fields separate when presenting an exercise.
Draw image and box dimensions and compute contain and cover sizes. Treat percentages as alignment or convert a source focal point into clamped alignment, delegate offsets, and return the visible source crop in original-image pixels.1
Delegated operations used for this result: object fit contain letterbox dims; object fit cover scale factor. Their calculation or parsing conventions apply to the corresponding result fields.2, 3
| Input field | Meaning and units | Accepted input |
|---|---|---|
| count | Requested count; the mechanics explain whether one draw expands into several returned records. | Required. Safe integer; minimum 1; maximum 64. |
| imageWidthPx | Image Width Px | Required. Object; no unknown keys. |
| imageWidthPx.minimum | Minimum | Required. Safe integer; minimum 1. |
| imageWidthPx.maximum | Maximum | Required. Safe integer; minimum 1. |
| imageHeightPx | Image Height Px | Required. Object; no unknown keys. |
| imageHeightPx.minimum | Minimum | Required. Safe integer; minimum 1. |
| imageHeightPx.maximum | Maximum | Required. Safe integer; minimum 1. |
| boxWidthPx | Box Width Px | Required. Object; no unknown keys. |
| boxWidthPx.minimum | Minimum | Required. Safe integer; minimum 1. |
| boxWidthPx.maximum | Maximum | Required. Safe integer; minimum 1. |
| boxHeightPx | Box Height Px | Required. Object; no unknown keys. |
| boxHeightPx.minimum | Minimum | Required. Safe integer; minimum 1. |
| boxHeightPx.maximum | Maximum | Required. Safe integer; minimum 1. |
| xPercent | X Percent | Required. Object; no unknown keys. |
| xPercent.minimum | Minimum | Required. Safe integer; minimum 0; maximum 100. |
| xPercent.maximum | Maximum | Required. Safe integer; minimum 0; maximum 100. |
| yPercent | Y Percent | Required. Object; no unknown keys. |
| yPercent.minimum | Minimum | Required. Safe integer; minimum 0; maximum 100. |
| yPercent.maximum | Maximum | Required. Safe integer; minimum 0; maximum 100. |
| positionMode | Position Mode | Required. Text; one of "alignment", "source-focal". |
| seed | Optional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed. | Optional. Safe integer. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| cases | Cases | Required. Array of Object; no unknown keys.; minimum items 1; maximum items 64. |
| cases[].imageWidthPx | Image Width Px | Required. Finite number. |
| cases[].imageHeightPx | Image Height Px | Required. Finite number. |
| cases[].boxWidthPx | Box Width Px | Required. Finite number. |
| cases[].boxHeightPx | Box Height Px | Required. Finite number. |
| cases[].inputXPercent | Input XPercent | Required. Finite number. |
| cases[].inputYPercent | Input YPercent | Required. Finite number. |
| cases[].fits | Fits | Required. Array of Object; no unknown keys.; minimum items 2; maximum items 2. |
| cases[].fits[].mode | Mode | Required. Text; one of "contain", "cover". |
| cases[].fits[].scale | Scale | Required. Finite number. |
| cases[].fits[].renderedWidthPx | Rendered Width Px | Required. Finite number. |
| cases[].fits[].renderedHeightPx | Rendered Height Px | Required. Finite number. |
| cases[].fits[].alignmentXPercent | Alignment XPercent | Required. Finite number. |
| cases[].fits[].alignmentYPercent | Alignment YPercent | Required. Finite number. |
| cases[].fits[].offsetXPx | Offset XPx | Required. Finite number. |
| cases[].fits[].offsetYPx | Offset YPx | Required. Finite number. |
| cases[].fits[].sourceCrop | Source Crop | Required. Object; no unknown keys. |
| cases[].fits[].sourceCrop.x | X | Required. Finite number. |
| cases[].fits[].sourceCrop.y | Y | Required. Finite number. |
| cases[].fits[].sourceCrop.width | Width | Required. Finite number. |
| cases[].fits[].sourceCrop.height | Height | Required. Finite number. |
| randomness | Replay metadata: source is seed or context; seed is the normalized 32-bit seed or null for a context source. | Required. Object; no unknown keys. |
| randomness.seed | Optional numeric replay seed; normalization and precedence are explained below. | Required. Safe integer. or Null. |
| randomness.source | Source | Required. Text; one of "context", "seed". |
An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.
{
"input": {
"count": 1,
"imageWidthPx": {
"minimum": 400,
"maximum": 400
},
"imageHeightPx": {
"minimum": 200,
"maximum": 200
},
"boxWidthPx": {
"minimum": 100,
"maximum": 100
},
"boxHeightPx": {
"minimum": 100,
"maximum": 100
},
"xPercent": {
"minimum": 25,
"maximum": 25
},
"yPercent": {
"minimum": 50,
"maximum": 50
},
"positionMode": "alignment",
"seed": 42
},
"output": {
"cases": [
{
"imageWidthPx": 400,
"imageHeightPx": 200,
"boxWidthPx": 100,
"boxHeightPx": 100,
"inputXPercent": 25,
"inputYPercent": 50,
"fits": [
{
"mode": "contain",
"scale": 0.25,
"renderedWidthPx": 100,
"renderedHeightPx": 50,
"alignmentXPercent": 25,
"alignmentYPercent": 50,
"offsetXPx": 0,
"offsetYPx": 25,
"sourceCrop": {
"x": 0,
"y": 0,
"width": 400,
"height": 200
}
},
{
"mode": "cover",
"scale": 0.5,
"renderedWidthPx": 200,
"renderedHeightPx": 100,
"alignmentXPercent": 25,
"alignmentYPercent": 50,
"offsetXPx": -25,
"offsetYPx": 0,
"sourceCrop": {
"x": 50,
"y": 0,
"width": 200,
"height": 200
}
}
]
}
],
"randomness": {
"seed": 42,
"source": "seed"
}
}
} Limitations and assumptions
- Contain can leave empty box space while cover can crop the source. No image is fetched or edited. Focal centering is clamped to feasible alignment and inherits floating-point calculator precision.
- A replay requires the same complete input and implementation. Randomized construction does not guarantee uniform coverage of every feasible output; finite samples can repeat unless a distinct-selection rule is explicitly stated.
- The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.
Alternative or Complementary methods
For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.
References
Similar or alternative tools
- Random Heading Hierarchy Mutation Corpus Generator
Mutate caller heading sequences at a constructible interior position to introduce an upward skip, retaining baseline and mutated markup and the existing outline heuristic.
- Random Image Alt Context Fixture Generator
Pair caller image descriptions with decorative/informative contexts and missing-alt controls, retaining presence-check results without judging alternative-text quality.