splicedesign / culture / practice
← All tools

Production tool

Image Ratio Calculator

Enter a source size and a target to get distortion-free dimensions, the closest standard ratio, and export sizes for 1x, 2x and 3x displays.

Inputs

Output

— ratio
Source ratio—
Closest preset—

Export sizes

DisplayCSS pxPhysical px

How to use it

  1. Enter your source image dimensions — you can read them from any file's properties dialog.
  2. Choose whether you know the final width or the final height, then type that value.
  3. Read the missing dimension. Exporting at these exact numbers keeps the image undistorted.
  4. If a platform demands a specific ratio, pick it in the crop list to see how much of each edge you will lose.
  5. Copy the 2x or 3x row for retina assets; the CSS px column is what you write in your stylesheet.

How it is calculated

Keeping proportions means preserving the ratio between the two sides, so the unknown side solves from the known one:

ratio = sourceWidth / sourceHeight

newHeight = newWidth / ratio
newWidth  = newHeight × ratio

gcd-based label: divide both sides by their greatest common divisor

Cropping to another ratio centres the frame and removes the excess from the longer edge. Trim per side is:

trimWidth  = sourceW − sourceH × targetRatio   (if positive)
trimHeight = sourceH − sourceW / targetRatio   (otherwise)

Display multiples simply multiply the CSS size by the device pixel ratio: 2x devices want double the physical pixels, 3x want triple.

Worked example

A 4000 × 3000 photo has a 4:3 ratio. Locking height at 1080px gives a width of 1080 × 4/3 = 1440px. If you then crop that result to 16:9 for a thumbnail, the width must fall from 1440 to 1920 — impossible at this height — so instead the height is trimmed: 1440 × 9/16 = 810px, meaning 270px total (135px top and bottom) is removed.

Crop in the composition stage whenever you can. Cropping after export throws away pixels you already paid to render, and never recovers sharpness.

Where this works, and where it does not

Use it for thumbnails, social assets, hero images, video frames and any asset that must fit a fixed layout slot. The arithmetic is identical everywhere, so the export sizes are portable between design tools.

It does not open your image file, so it cannot tell you whether the subject survives the crop, nor estimate final file weight — that depends on compression and content. It also assumes pixel-exact inputs; if your source has non-square pixels, correct that first.