Source: https://guthlabs.ai/docs/instruments/aspect-ratio-crop-calculator/mechanism/

instrument mechanism / verified-clean

# Aspect Ratio / Crop Calculator mechanism

The inspectable method record for Aspect Ratio / Crop Calculator, kept separate from implementation and qualification.

Status: **VERIFIED_CLEAN**Lifecycle: **verified-clean**

## Model scope

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.

- 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.

## Units and conventions

- 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.

## Inspectable vector

One of 4 source-bound review vectors:

````
{
  "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."
}
````

## Failure boundary

**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.

## Other records

[01**Overview**](<https://guthlabs.ai/docs/instruments/aspect-ratio-crop-calculator/>)[03**Implementation**](<https://guthlabs.ai/docs/instruments/aspect-ratio-crop-calculator/implementation/>)[04**Qualification**](<https://guthlabs.ai/docs/instruments/aspect-ratio-crop-calculator/qualification/>)

## Sources and evidence

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

- `VERIFIED_LEDGER.json`

- `evidence-tranche5/tranche5-results.json`

- `BOUNDARY_HAZARD_CATALOG.json`
