How to Find an Image’s Aspect Ratio
Learn how to calculate an image’s aspect ratio from its pixel dimensions, check it with ImageMagick, and avoid common ratio and resolution mistakes.
To find an image’s aspect ratio, read its pixel width and height, write them as width:height, then divide both numbers by their greatest common divisor. A 1,200 × 800 image becomes 1,200:800, which reduces to 3:2.
The convention in this guide is width:height. Aspect ratio describes an image’s shape. It does not describe file size, DPI, print resolution, or image quality.
1. Calculate the aspect ratio from dimensions
- Find the image dimensions, usually shown as width × height in pixels.
- Put the width first and height second.
- Find the greatest common divisor (GCD) of the two numbers.
- Divide both dimensions by that same GCD.
| Pixel dimensions | Calculation | Aspect ratio | Orientation |
|---|---|---|---|
| 1,200 × 800 | 1,200 ÷ 400 : 800 ÷ 400 | 3:2 | Landscape |
| 1,920 × 1,080 | 1,920 ÷ 120 : 1,080 ÷ 120 | 16:9 | Landscape |
| 800 × 800 | 800 ÷ 800 : 800 ÷ 800 | 1:1 | Square |
| 800 × 1,200 | 800 ÷ 400 : 1,200 ÷ 400 | 2:3 | Portrait |
| 1,000 × 667 | Already nearly reduced | 1,000:667 | Landscape |
If the numbers have no common factor greater than 1, the unreduced pair is already the simplest exact ratio. You can still write it as 1000:667.
2. Find the width and height
The calculation is only as accurate as the dimensions you read. Use the image file’s pixel dimensions, rather than the size of a preview, browser window, or printed copy.
Operating system or image viewer
Open the file information or image details shown by your operating system or viewer and look for dimensions expressed as width × height. Interface names and menu locations vary by platform and version, so use the dimensions displayed by the application you already have.
Photos on Mac
Apple’s Photos documentation describes crop controls with preset and custom aspect ratios and an option to constrain a photo to its original ratio. Cropping changes the photo throughout Photos, so duplicate the original first if you need to preserve it. This is useful when you also plan to edit the image; for calculation alone, the file dimensions are sufficient. Apple’s Photos guide
Photoshop
In Photoshop, open Image > Image Size to view width and height. Adobe documents the Constrain aspect ratio control, which preserves proportions while you resize. Read the displayed dimensions to calculate the ratio, and keep the constraint enabled when changing size proportionally. Adobe’s resize documentation
3. Check dimensions from the command line
For repeated checks or batch work, ImageMagick’s identify utility reports image dimensions and other metadata.
identify photo.jpg
The output includes the width and height. For example, an output containing 1200x800 means the ratio is 1200:800, which reduces to 3:2. See the ImageMagick identify documentation for the utility and supported formats.
Batch-friendly shell example
for file in images/*; do
identify "$file"
done
This prints each file’s dimensions. The ratio reduction can then be automated in a script if you are processing a large collection.
4. Reduce a ratio with the greatest common divisor
The GCD is the largest integer that divides both dimensions without a remainder. For 1,920 × 1,080, the GCD is 120:
1920 ÷ 120 = 16
1080 ÷ 120 = 9
Aspect ratio = 16:9
You can calculate the GCD programmatically with Euclid’s algorithm:
function gcd(a, b) {
while (b !== 0) {
[a, b] = [b, a % b];
}
return Math.abs(a);
}
const width = 1920;
const height = 1080;
const divisor = gcd(width, height);
console.log(`${width / divisor}:${height / divisor}`); // 16:9
5. Understand what the ratio means
- 1:1 means width and height are equal, so the image is square.
- If the first number is larger, the image is landscape.
- If the second number is larger, the image is portrait.
- Different pixel sizes can share the same ratio. Both 1,920 × 1,080 and 3,840 × 2,160 are 16:9.
- Resizing both dimensions by the same factor preserves the ratio.
- Cropping can change the ratio because it changes which pixels remain.
6. Aspect ratio compared with resolution, file size, and print dimensions
| Term | What it tells you | What it does not tell you |
|---|---|---|
| Aspect ratio | The width-to-height shape, such as 3:2 | Pixel count, storage size, or image quality |
| Pixel dimensions | Exact width and height, such as 1,200 × 800 | Whether the file is compressed or suitable for a particular print size |
| File size | Storage used, such as 450 KB or 4 MB | The image’s shape |
| DPI/PPI | Print or display density metadata | The pixel width-to-height relationship |
Changing DPI metadata alone does not change the pixel ratio. Physical width and height keep the same ratio only when they are scaled proportionally.
7. Cropping, resizing, and choosing a target ratio
Resizing proportionally
To keep the ratio, multiply width and height by the same factor. A 1,200 × 800 image scaled to 600 pixels wide becomes 600 × 400, still 3:2.
Cropping to a new ratio
A crop selection can have a different ratio from the source. Cropping a 3:2 image to a square removes pixels from the sides or top and bottom, depending on the crop position. Duplicate the source before applying a crop when you need the original composition later. Apple specifically warns that applying a crop affects the photo throughout Photos. Apple’s crop guidance
Fit versus fill
- Fit keeps the entire image visible and may add empty space around it.
- Fill covers the target frame and may crop part of the image.
Choose based on whether preserving every pixel or filling the destination frame matters more.
8. Troubleshooting common mistakes
| Problem | Cause | Fix |
|---|---|---|
| The ratio is backwards | Height was written first | Use the documented convention: width:height. |
| 1920 × 1080 was reported as 1920:1080 | The pair was not reduced | Divide both values by their GCD, 120, to get 16:9. |
| The ratio changed after editing | The image was cropped or stretched | Check the new pixel dimensions; constrain proportions during resizing. |
| A preview gives unexpected dimensions | The preview was scaled | Read the original file’s metadata or dimensions. |
| DPI changed but the ratio did not | DPI is density metadata | Compare pixel width and height instead. |
| Two files with the same ratio have different quality | Pixel dimensions or compression differ | Compare dimensions and file size separately from the ratio. |
| ImageMagick cannot identify the file | Unsupported, damaged, or inaccessible file | Confirm the path and permissions, check the file type, and try opening a known-good copy. |
9. A repeatable checklist
- Read the original pixel width and height.
- Write them in width:height order.
- Calculate the greatest common divisor.
- Divide both values by that divisor.
- Label the result as square, landscape, or portrait.
- Check whether a crop changed the dimensions.
- Keep aspect ratio, pixel dimensions, file size, and DPI as separate facts.
10. Or skip the browser setup
If you are checking the ratio of a screenshot or web image, ScreenshotNeo can produce a clean image from a URL. Its API returns PNG, JPEG, WebP, or PDF, and the resulting file’s width and height can be used with the calculation above.
Use the direct request shown in the ScreenshotNeo API documentation:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const buffer = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', buffer));
ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing result. Its MCP server lets AI agents use take_screenshot, get_page_info, and capture_pdf. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots.
Create a free ScreenshotNeo account to generate screenshots and inspect their dimensions.
11. Performance, reliability, and cost notes
- For one image, reading the displayed dimensions is faster than installing a tool.
- For many files, ImageMagick’s
identifyutility avoids opening each image manually. - Ratio arithmetic is deterministic; errors usually come from reading preview dimensions, reversing width and height, or changing the crop.
- Keep the original file when testing crops or resizes so you can recalculate from the source.
- A ratio calculation requires no paid software. Screenshot capture introduces a separate service request and plan usage; ScreenshotNeo reports whether a response was billed through its headers.
12. FAQ
Is aspect ratio written width × height or height × width?
Write it as width:height. A 1,920 × 1,080 image is 16:9.
Can I find the ratio without software?
Yes. If you know the pixel dimensions, divide both numbers by their GCD using a calculator or by hand.
Does compressing a JPEG change its aspect ratio?
No. Compression changes file data and often file size, but the ratio remains the same unless the pixel dimensions change.
What if the dimensions are not cleanly reducible?
Use the unreduced pair, such as 1,000:667. It is still an exact aspect ratio.
Does rotating an image change its ratio?
Rotating 1,200 × 800 to 800 × 1,200 changes the written orientation from 3:2 to 2:3, while the underlying shape is the same turned ninety degrees.


