Crop operation. Extracts a sub-rectangle of the working image.
Distinct from Image.Plug.Pipeline.Ops.Trim, which auto-detects or
removes a border, and distinct from Image.Plug.Pipeline.Ops.Resize's
fit modes, which scale-and-fit. Crop is an absolute extract of the
region described by (x, y, width, height).
Two coordinate systems via :units:
:pixels(default) —x,y,width,heightare measured in pixels of the source image.(0, 0)is the top-left corner.:percent— all four values are floats in0.0..100.0, interpreted as percentages of the source image's dimensions. The interpreter resolves them against the actual source size at apply time, which means the same op can be reused across sources of different dimensions.
Used by
- The IIIF Image API 3.0 provider's
regionURL segment, which accepts bothx,y,w,h(pixels) andpct:x,y,w,h(percent) forms.
Canonical order
Per Image.Plug.Pipeline.Normaliser, Crop runs after Trim /
Background and before Resize. The IIIF spec processes operations
in this same order — region → size → rotation → quality → format —
so a IIIF round-trip preserves intent.