The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Use the image’s effective width and height. Write the aspect ratio as width:height, optionally reduce both numbers by their greatest common divisor, and divide width by height for a decimal. For orientation, compare those same dimensions: width greater than height is landscape, height greater than width is portrait, and equal dimensions are square.
For display and layout work, calculate from dimensions after applying EXIF orientation exactly once. A JPEG can store pixels in one direction while metadata tells software to rotate them for viewing.
Aspect ratio and orientation are different calculations
Aspect ratio describes proportion, not size. A 3,000 × 2,000 image and a 600 × 400 image both have a 3:2 aspect ratio because width is 1.5 times height. Orientation describes which side is longer.
| Width and height | Reduced ratio | Decimal ratio | Orientation |
|---|---|---|---|
| 3000 × 2000 | 3:2 | 1.5 | Landscape |
| 2000 × 3000 | 2:3 | 0.6667 | Portrait |
| 1200 × 1200 | 1:1 | 1 | Square |
| 1600 × 900 | 16:9 | 1.7778 | Landscape |
Always state whether your labels refer to encoded pixel dimensions or intended displayed dimensions. Those can differ when orientation metadata is present.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
- 16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting
- Optical Zoom: 4x optical zoom with a 27mm wide angle lens for flexible framing indoors or outdoors
- Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
- Memory Support: Works with Class 10 SD, SDHC, or SDXC cards up to 512GB
- LCD Screen and Battery: 2.7in LCD screen with 2 AA alkaline batteries for convenient on-the-go use
Calculate a ratio from width and height
Keep the original pixel ratio
Start with positive integer dimensions W and H. The unreduced ratio is simply W:H. This form preserves the exact source dimensions and is useful when debugging or matching an API response.
Reduce the ratio with the greatest common divisor
To produce a compact pair, calculate gcd(W,H), then divide both values by it:
reducedWidth = W / gcd(W,H)reducedHeight = H / gcd(W,H)
For 2,400 × 1,600, the greatest common divisor is 800, so the reduced ratio is 3:2. If the dimensions are 1,920 × 1,080, the divisor is 120 and the result is 16:9.
Return a decimal when a comparison needs one number
Compute W / H using floating-point arithmetic. A value above 1 is wider than tall; below 1 is taller than wide; exactly 1 is square. Keep enough precision for your use case, but do not replace the pair with a rounded decimal when exact matching matters.
Classify landscape, portrait, or square
After you have the dimensions you intend to describe:
- Landscape:
width > height. - Portrait:
width < height. - Square:
width === height.
This is a geometric test. It does not inspect the subject, horizon, faces, or other visual content. A photograph of a person can be landscape if its canvas is wider than tall.
Rank #2
- 16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting
- Optical Zoom: 5x optical zoom with a 28mm wide angle lens for flexible framing indoors or outdoors
- Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
- Memory Support: Works with Class 10 SD, SDHC, or SDXC cards up to 512GB
- LCD Screen and Battery: 2.7in LCD screen and a rechargeable lithium-ion battery for on-the-go use
Handle EXIF orientation before classifying displayed images
Some JPEG files store pixels in a camera-native direction and include an EXIF Orientation value instructing software to rotate and/or mirror them. A quarter-turn swaps displayed width and height; a mirror changes handedness without swapping dimensions.
Recommended Free Tools
Choose the dimension semantics first
- Encoded orientation: classify the raw stored pixel matrix. This is appropriate for low-level file inspection.
- Display orientation: classify how the image should appear to a user. This is normally the right choice for responsive layouts, thumbnails, and UI decisions.
Do not mix these definitions in one pipeline. A 4,000 × 3,000 stored image with a 90-degree EXIF rotation should be treated as 3,000 × 4,000 for display orientation.
Apply the transform exactly once
Decoders and frameworks differ. Some expose raw dimensions and metadata; others automatically apply the transform. UIKit’s image object handles the transform needed to present an image according to its orientation metadata. Core Image provides operations that return or apply the required transform. Sharp’s autoOrient() applies the EXIF Orientation transform, supports mirroring, and removes the Orientation tag afterward.
If your decoder has already oriented the pixels, do not rotate them again. Double application can turn a portrait image back into landscape or mirror it incorrectly. Sharp’s operation considers the EXIF Orientation tag; orientation stored elsewhere, such as an XMP element, remains your responsibility.
Keep coordinates in the same space
If you draw face boxes, click targets, watermarks, or annotations, transform those coordinates along with the pixels. A bounding box measured in raw coordinates will be displaced after a 90-degree rotation unless you convert it to the oriented coordinate system. Services that return bounding boxes may define them relative to a particular orientation, so follow that service’s coordinate convention.
A reliable automatic workflow
- Read the file. Use a decoder that reports width, height, and orientation metadata where supported.
- Define the goal. Decide whether the result describes stored pixels or the displayed image.
- Normalize display orientation. Apply the EXIF rotation or mirror once, or account for it mathematically if you are not rewriting pixels.
- Read effective dimensions. Use the dimensions after that transform for display-oriented results.
- Classify. Compare width and height using the three-way test.
- Format the ratio. Return the original pair, a reduced integer pair, a decimal, or all three with explicit labels.
Pseudocode:
read width, height, and orientation metadata
if display_orientation_required:
apply_or_account_for_orientation_once
if width > height:
orientation = "landscape"
else if width < height:
orientation = "portrait"
else:
orientation = "square"
g = gcd(width, height)
ratio_pair = (width / g) + ":" + (height / g)
ratio_decimal = width / height
APIs differ on whether dimensions are reported before or after a transform, and format support varies. Confirm the selected library’s documentation for the exact runtime and file types you accept.
Implementation examples
JavaScript in a browser
The browser’s Image object gives intrinsic dimensions, but it does not consistently expose every camera orientation workflow in the same way. Use a metadata-aware decoder when EXIF correctness is required.
Rank #3
- Latest Digital Camera Built-in Fill Light : This compact digital camera is paired with a powerful CMOS processor and image stabilization to help you take & record the most exciting moments in 44 MP quality images & FHD 1080P quality videos anywhere, anytime. Plus, there is also a built-in fill light to help you take high quality pictures even in low light&dark settings, making this the perfect camera for all indoors/outdoors situations.
- Long-Lasting Battery Life & 16X Digital Zoom :This point and shoot camera will retain its battery charge even after long use. The controls and functions are easy to operate making this the perfect choice for children, teens and younger. This kids camera supports 16x digital zoom, you can zoom in or out the subject by pressing the W/T button for taking still photos to zoom in or out on distant objects and capture all the details you need.
- Multifunctional & Portable Digital Camera: This cheap digital camera is slim enough to fit in your pocket. You'll easily be able to take it with you on all your indoor/outdoor activities and adventures and ideal for beginners, children and teenagers. This kids digital camera is equipped with 20 filters, anti-shaking, self-timer, continuous shooting, date stamp, time-lapse recording, smile capture, internal MIC and speaker (recording sound videos), great for your daily photography needs.
- WEBCAM & PAUSE FUNCTION : More than just a FHD 1080p digital camera, it also works as a webcam for video calls and vlogging. Connect the camera to the computer, press shutter and power button at the same time and the camera will automatically turn on webcam mode for all your video calling and live streaming needs. The pause function allows you to pause when seeing playback videos.
- A Must Have Photography Device : This digital camera with SD card made from high-quality materials, this retro camera is safe and durable. Perfect for all ages to develop & improve their photographic abilities and observation skills. Our dedicated and experienced 24/7 support team is available for all after purchase troubleshooting, questions and technical help.
function gcd(a, b) {
while (b !== 0) [a, b] = [b, a % b];
return Math.abs(a);
}
function classify(width, height) {
if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) {
throw new Error("Width and height must be positive numbers");
}
const divisor = gcd(Math.round(width), Math.round(height));
return {
width,
height,
orientation: width > height ? "landscape" : width < height ? "portrait" : "square",
ratio: `${width}:${height}`,
reducedRatio: `${width / divisor}:${height / divisor}`,
decimal: width / height
};
}
const image = new Image();
image.onload = () => console.log(classify(image.naturalWidth, image.naturalHeight));
image.src = URL.createObjectURL(file);
For a display-oriented result, pass dimensions from a decoder after it has applied EXIF orientation rather than blindly using raw file dimensions.
Python
from math import gcd
def image_metrics(width: int, height: int) -> dict:
if width <= 0 or height <= 0:
raise ValueError("width and height must be positive")
divisor = gcd(width, height)
return {
"width": width,
"height": height,
"orientation": (
"landscape" if width > height else
"portrait" if width < height else
"square"
),
"ratio": f"{width}:{height}",
"reduced_ratio": f"{width // divisor}:{height // divisor}",
"decimal": width / height,
}
print(image_metrics(3000, 2000))
Use an EXIF-aware imaging library to obtain oriented dimensions before calling this function. Whether a library mutates pixels, removes metadata, or merely reports a transform is implementation-specific.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallNode.js
function gcd(a, b) {
while (b) [a, b] = [b, a % b];
return Math.abs(a);
}
function metrics(width, height) {
if (width <= 0 || height <= 0) throw new Error("Invalid dimensions");
const g = gcd(width, height);
return {
orientation: width > height ? "landscape" : width < height ? "portrait" : "square",
ratio: `${width}:${height}`,
reducedRatio: `${width / g}:${height / g}`,
decimal: width / height
};
}
console.log(metrics(1920, 1080));
Validate inputs and edge cases
- Zero or missing dimensions: reject them before dividing; an image with height zero has no valid aspect ratio.
- Non-integer values: dimensions normally represent pixels, so round-trip APIs should return integers. Reject fractional or suspicious metadata rather than silently producing a misleading reduced ratio.
- Animated formats: decide whether you need the canvas dimensions or a particular frame; frames can have format-specific behavior.
- Transparency: alpha does not alter aspect ratio. A transparent canvas is still classified by its width and height.
- Very large files: inspect metadata first where possible, and set memory and decompression limits before decoding untrusted uploads.
- Unknown orientation tags: treat the file as requiring review or use the decoder’s documented fallback. Do not guess a rotation from visual content.
- Already-normalized images: after pixels are transformed, remove or update orientation metadata as your library requires, otherwise another consumer may apply the transform again.
Choosing an image-processing approach
| Question | Why it matters |
|---|---|
| Does it read EXIF Orientation? | Raw dimensions alone may not describe the displayed image. |
| Does it rotate and mirror, or only report a transform? | You must know whether to change pixels yourself. |
| Are dimensions pre- or post-transform? | This determines the orientation classification. |
| What happens to metadata? | Retaining a tag after transforming pixels can cause double rotation. |
| Are overlays and boxes transformed? | Coordinates must remain aligned with the image. |
| Which formats and runtime versions are supported? | Documentation for one format or platform is not a guarantee for all files. |
Or skip the browser setup
If your goal is to obtain a clean image of a web page before measuring or processing it, ScreenshotNeo provides a single screenshot API request. It accepts cookie and consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and each response identifies the result with X-Page-Verdict and X-Billed headers. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.
Use the language you prefer:
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)
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}`);
See the complete parameter reference in the ScreenshotNeo documentation. Options include full-page captures with lazy images loaded, CSS-selector element capture, dark mode, device presets, custom viewports and retina scale, PDF output, custom CSS and JavaScript, click actions, selector waits, network-idle waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Common parameter names from other screenshot APIs also work.
The Free plan includes 1,000 screenshots each month with no card. Paid plans start at $5 for 3,000 shots; Growth is $15 for 15,000, Pro $39 for 60,000, Scale $99 for 250,000, and Business $249 for 1,000,000. Yearly billing gives two months free, and every feature is available on every plan. Create a free ScreenshotNeo account.
Troubleshooting
The result says portrait, but the photo looks landscape
You likely classified encoded pixels while the JPEG’s EXIF Orientation requests a quarter-turn. Apply the transform once, then compare the oriented dimensions.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →The image flips or rotates twice
Your decoder or UI already applied EXIF orientation and your code applied it again. Track whether dimensions and pixels are raw or normalized, and remove the orientation tag after a pixel transform when the library recommends it.
The reduced ratio is not an integer pair
Ensure both inputs are pixel integers and use the greatest common divisor, not a rounded decimal approximation. For non-pixel dimensions, return the unreduced pair or a decimal explicitly.
Rank #4
- 16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting
- Optical Zoom: 5x optical zoom with a 28mm wide angle lens for flexible framing indoors or outdoors
- Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
- Memory Support: Works with Class 10 SD, SDHC, or SDXC cards up to 512GB
- LCD Screen and Battery: 2.7in LCD screen and a rechargeable lithium-ion battery for on-the-go use
Annotations no longer line up
Transform bounding boxes and click coordinates into the same oriented coordinate space as the rendered image. Keep the original dimensions if you must map results back to raw file coordinates.
A screenshot contains a popup that changes measured dimensions
Capture after dismissing or removing the popup, or use ScreenshotNeo’s consent, popup, and chat-widget cleanup before processing the resulting image.
Frequently Asked Questions
Should I store an aspect ratio as “16:9” or 1.7778?
Store the exact width and height when fidelity matters, and derive both a reduced pair and decimal for presentation. The pair is easier to compare against known formats; the decimal is convenient for numeric thresholds.
Does mirroring change an image’s aspect ratio?
No. A mirror changes left and right but keeps width and height unchanged. A 90- or 270-degree rotation swaps them.
Can visual content determine orientation?
Not reliably. Automatic landscape, portrait, and square classification is based on dimensions. Content analysis is a separate computer-vision task.
What should an API return for an EXIF-rotated JPEG?
Document whether width and height are raw encoded values or post-orientation display values. For layout APIs, post-orientation values are usually less surprising.
Free tools Windows power users keep installed
One-click scans. No signup required.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




