Skip to content

Main content

Digital Humanities: IIIF Xywh Region Token Tool

Parse a restricted IIIF xywh region into pixel or percentage fields, rejecting zero extents and percentage boxes beyond 100; no image retrieval or full Image API parser.

Loading tool…

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

  1. Enter token. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. 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 fieldMeaning and unitsAccepted input
tokenOptional 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 fieldInterpretationReturned shape
resultReturned object; expand its named members below.Required. Object.
result.xXCalculated result member: number.
result.yYCalculated result member: number.
result.widthExtent on the stated coordinate or temporal basis.Calculated result member: number.
result.heightHeightCalculated result member: number.
result.percentTrue for the pct: form; fractional percent values are rejected by this restricted parser.Calculated result member: boolean.
json
{
  "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

  1. Calculation and input contract: digital-humanities/iiif-xywh-region-token — tool.io

  2. IIIF Image API 3.0: region — IIIF Consortium

Similar or alternative tools