Guth
NewsDocs
Page actions
View as Markdown ↗
Explore MCP tools ↗

instrument / verified-clean

Aspect Ratio / Crop Calculator

The current ledger marks this instrument verified clean within the source-bound verification corpus.

Status: VERIFIED_CLEANLifecycle: verified-clean

Inspectable records

Ledger state

The current ledger marks this instrument verified clean within the source-bound verification corpus.

Area
Audio, Music, Photography & Color
Tranche
tranche-5
Evidence ID
t5-001
Ledger rows
1

No ledger note is attached.

Review findings

The core uniform-fit formula is standard, but the specification needs explicit definitions for total versus per-side bar thickness, crop behavior, input units, integer rounding, and upscaling. It should either remove crop-pixels from the fit mode or add a separately documented crop-to-fill formula and mode.

Formula and scope findings

  • The scale formula is correct for uniformly fitting the entire source inside the target, assuming upscaling is allowed: scale=min(targetW/srcW,targetH/srcH).
  • Bar-size calculation is underspecified: total leftover space is targetW-fittedW and targetH-fittedH, while per-side bar thickness is half of each leftover; the spec does not say which value is output.
  • No crop formula is provided. A fit operation produces no crop pixels, so the claimed crop-pixels output is either always zero or requires a separate crop-to-fill mode and formula.
  • Pixel rounding behavior is unspecified; fitted dimensions and per-side bars can be fractional even when all inputs are integer pixel dimensions.
  • The spec does not state whether source and target dimensions must use the same units or whether aspect-ratio-only inputs are supported.

Unit assumptions

  • All source and target dimensions are positive pixel counts unless explicitly documented otherwise.
  • sourceW, sourceH, targetW, and targetH must use the same linear unit; dimensions in pixels are assumed for the test vectors.
  • Fitted dimensions are computed as real numbers before any optional integer-pixel rounding.
  • Bar sizes below report both total leftover space and equal per-side thickness.
  • Because this is fit-without-cropping, cropPixels is expected to be 0 in these vectors.

Boundary hardening

BREAK_CLAIMED · SELF_FLAGGED

Zero source dimensions make the scale formula undefined, but a naive plain-JavaScript implementation could propagate Infinity or invalid fitted dimensions instead of rejecting the input. The specification does not state explicit validation behavior for zero or negative resolutions.

Errata and corrections

No applied erratum is attached to this unique-name record.

Inspectable example

4 review vectors are recorded. One source-bound sample is shown below.

{
  "inputs": {
    "sourceW": 1920,
    "sourceH": 1080,
    "targetW": 1920,
    "targetH": 1080,
    "units": "pixels"
  },
  "expected_outputs": {
    "scale": 1,
    "fittedWidth": 1920,
    "fittedHeight": 1080,
    "barLeft": 0,
    "barRight": 0,
    "barTop": 0,
    "barBottom": 0,
    "cropPixels": 0
  },
  "working": "scale=min(1920/1920,1080/1080)=min(1,1)=1. fittedWidth=1920*1=1920. fittedHeight=1080*1=1080. leftoverWidth=1920-1920=0, so left/right bars=0/2=0 each. leftoverHeight=1080-1080=0, so top/bottom bars=0/2=0 each. No cropping occurs, so cropPixels=0."
}

Related workflows

No source-defined multi-instrument workflow membership is recorded.

Sources and evidence

These pointers bind the page to evidence. They do not grant authority or collapse verification into deployment.

  • VERIFIED_LEDGER.json · VERIFIED_CLEAN
  • evidence-tranche5/tranche5-results.json
  • BOUNDARY_HAZARD_CATALOG.json