Description
Round and clip a supplied region axis.
IIIF-related selectors describe image regions, canvas coordinates and media intervals. A local arithmetic helper can use a restricted syntax or rounding convention while a full IIIF request must satisfy the API and server behavior.
Round and clip a supplied region axis.
When to use this tool
Use IIIF Region Edge Precision Token when checking the stated image-region, scaling or media-range convention.
How to use the tool and how it works
- Enter start, extent, imageExtent, rounding. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read startPixel, endPixel, clipped. Inspect clipped before interpreting the associated values.
Round and clip a supplied region axis. Require positive whole imageExtent, nonnegative extent and rounding outward or inward; round endpoints accordingly, reject reversed results, then clamp to [0,imageExtent] and return clipped.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| start | Start | Required. Finite number. |
| extent | Extent | Required. Finite number; minimum 0. |
| imageExtent | Image Extent | Required. Safe integer; minimum 1. |
| rounding | Rounding | Required. Text; one of "outward", "inward"; maximum UTF-16 length 8192. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| startPixel | Start Pixel | Required. Safe integer. |
| endPixel | End Pixel | Required. Safe integer. |
| clipped | Raw start is negative or raw end exceeds imageExtent; not a comparison of rounded values. | Required. Boolean. |
{
"input": {
"start": 1.2,
"extent": 3.6,
"imageExtent": 10,
"rounding": "outward"
},
"output": {
"startPixel": 1,
"endPixel": 5,
"clipped": false
}
} Limitations and assumptions
- clipped tests raw start < 0 or end > extent; no image retrieval or full region validation occurs.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Use a conforming IIIF client and actual manifest or image information for complete request validation and resource access.
References
Similar or alternative tools
- IIIF Region Normalized Offset
Normalize an in-bounds rectangle to image fractions.
- IIIF Region Area Share
Return an in-image rectangle's area fraction.