Skip to content

Main content

Canvas Crop Margin Layout Tool

Calculate a rectangular canvas crop from four explicit nonnegative edge margins.

Loading tool…

Description

Subtract left/right and top/bottom margins for croppedWidth and croppedHeight.

Layout calculations relate dimensions, offsets, and normalized positions in a drawing or display. A numeric coordinate depends on its origin and scale, while a size allowance must use the same length unit as the object.

Subtract left/right and top/bottom margins for croppedWidth and croppedHeight.

When to use this tool

Use Canvas Crop Margin Layout when you need a stated layout component from supplied dimensions or a normalized position.

How to use the tool and how it works

  1. Enter canvasWidth, canvasHeight, cropLeft, cropTop, cropRight, cropBottom. 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 croppedWidth, croppedHeight. Use the output convention below.

Require nonnegative dimensions and crop margins whose opposing sums fit each canvas axis. Subtract left/right and top/bottom margins for croppedWidth and croppedHeight.1

Input fieldMeaning and unitsAccepted input
canvasWidthCanvas WidthRequired. Finite number; minimum 0.
canvasHeightCanvas HeightRequired. Finite number; minimum 0.
cropLeftCrop LeftRequired. Finite number; minimum 0.
cropTopCrop TopRequired. Finite number; minimum 0.
cropRightCrop RightRequired. Finite number; minimum 0.
cropBottomCrop BottomRequired. Finite number; minimum 0.
Output fieldInterpretationReturned shape
croppedWidthCropped WidthRequired. Finite number.
croppedHeightCropped HeightRequired. Finite number.
json
{
  "input": {
    "canvasWidth": 100,
    "canvasHeight": 80,
    "cropLeft": 10,
    "cropTop": 5,
    "cropRight": 20,
    "cropBottom": 15
  },
  "output": {
    "croppedWidth": 70,
    "croppedHeight": 60
  }
}

Limitations and assumptions

  • Zero-sized crops are accepted; image resampling, bleed, print resolution, and actual content are not evaluated.
  • 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

Check the assembled layout at its final scale and include installation or production allowances separately.

References

  1. Calculation and input contract: visual-arts/canvas-crop-margin-layout — tool.io

Similar or alternative tools