Skip to content

Main content

IIIF Region Edge Precision Token Tool

Resolve one supplied pixel-region axis under explicit inward/outward rounding; not a full IIIF URI parser.

Loading tool…

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

  1. Enter start, extent, imageExtent, rounding. 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 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 fieldMeaning and unitsAccepted input
startStartRequired. Finite number.
extentExtentRequired. Finite number; minimum 0.
imageExtentImage ExtentRequired. Safe integer; minimum 1.
roundingRoundingRequired. Text; one of "outward", "inward"; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
startPixelStart PixelRequired. Safe integer.
endPixelEnd PixelRequired. Safe integer.
clippedRaw start is negative or raw end exceeds imageExtent; not a comparison of rounded values.Required. Boolean.
json
{
  "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

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

Similar or alternative tools