Description
Parse a restricted IIIF-style xywh token.
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.
Parse a restricted IIIF-style xywh token.
When to use this tool
Use Digital Humanities: IIIF Xywh Region Token when checking the stated image-region, scaling or media-range convention.
How to use the tool and how it works
- Enter token. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read result. Expand result to inspect the returned fields.
Parse a restricted IIIF-style xywh token. Accept optional pct: and four 1-9-digit nonnegative integer fields with positive width/height; percentages must remain within 100 on each axis. Return the numbers and percent flag.1
The Image API permits percentage regions with fractional values; this integer-only helper intentionally recognizes a narrower form.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| token | Optional pct: prefix followed by x,y,width,height; integer components of 1-9 decimal digits only. | Required. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Returned object; expand its named members below. | Required. Object. |
| result.x | X | Calculated result member: number. |
| result.y | Y | Calculated result member: number. |
| result.width | Extent on the stated coordinate or temporal basis. | Calculated result member: number. |
| result.height | Height | Calculated result member: number. |
| result.percent | True for the pct: form; fractional percent values are rejected by this restricted parser. | Calculated result member: boolean. |
{
"input": {
"token": "pct:10,20,30,40"
},
"output": {
"result": {
"x": 10,
"y": 20,
"width": 30,
"height": 40,
"percent": true
}
}
} Limitations and assumptions
- This restricted parser rejects fractional percent values allowed in broader IIIF use; no image bounds are checked for pixel tokens.
- Outputs are nested inside result. 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.
Alternative or Complementary methods
Use a conforming IIIF client and actual manifest or image information for complete request validation and resource access.
References
-
Calculation and input contract: digital-humanities/iiif-xywh-region-token — tool.io
-
IIIF Image API 3.0: region — IIIF Consortium
Similar or alternative tools
- IIIF Region Percent Pixel One Axis
Convert one percent region axis to outward-rounded pixel bounds.
- IIIF Region Normalized Offset
Normalize an in-bounds rectangle to image fractions.