Screpy - AI SEO Audit Tool

Image Aspect Ratio: Fix Distorted Images and Layout Shifts

Fix images displayed at the wrong proportions, reserve layout space, and use responsive CSS without stretching visual content.

Reviewed by Screpy Editorial Team

What an incorrect aspect ratio means

An image has an incorrect displayed aspect ratio when its rendered width and height do not preserve the proportions of the source file. A 1200 by 800 image has a 3:2 ratio. Forcing it into a square without intentional cropping stretches or compresses the visual.

This problem can make product images, screenshots, logos, and faces look distorted. Missing dimensions can also prevent the browser from reserving space before an image loads, contributing to Cumulative Layout Shift.

Choose the intended behavior

There are two valid outcomes:

  • Preserve the complete image. Keep width and height proportional and allow one dimension to calculate automatically.
  • Crop the image into a designed frame. Give the frame a ratio and use object-fit: cover so the image is cropped rather than stretched.

Do not force both dimensions to values that conflict with the source ratio unless distortion is an intentional effect.

Preserve the full image

<img src="dashboard.png" width="1200" height="800" alt="Screpy website audit dashboard">
img {
  display: block;
  max-width: 100%;
  height: auto;
}

The width and height attributes communicate the intrinsic ratio. Responsive CSS can still scale the image while preserving that ratio.

Crop into a fixed design

.thumbnail {
  aspect-ratio: 16 / 9;
  width: 100%;
  object-fit: cover;
}

Use a focal-position rule when the important part of an image would otherwise be cropped. For logos and diagrams, contain is often safer than cover.

Responsive image checks

  1. Confirm that every srcset candidate represents the same composition and ratio unless art direction is intentional.
  2. When using the picture element for art direction, provide dimensions or ratio information for each source.
  3. Test the smallest and largest container widths.
  4. Check lazy-loaded images because a missing placeholder size can create a shift later in the page.
  5. Verify CSS from parent components; fixed heights, grid rows, and inherited object-fit rules often cause the distortion.

SVG, background, and generated images

SVG files should have a useful viewBox. CSS background images use background-size instead of object-fit. Generated thumbnails should be created at the final intended ratio where possible, which reduces unpredictable cropping and unnecessary bytes.

How to verify the fix

Compare the intrinsic and rendered dimensions in browser developer tools. Resize the viewport, confirm that the subject is not stretched, and run a layout-shift check. The web.dev guide to optimizing Cumulative Layout Shift explains why image dimensions and reserved space matter.

Recheck image and page signals after the visual fix.

Use Screpy Website Analyzer to review the live page after correcting image dimensions or CSS. For image problems repeated across product, category, or article templates, use Website Audit to investigate the wider pattern.

  • Match the displayed width-to-height ratio to the source image unless cropping is intentional.
  • Set intrinsic width and height or reserve equivalent space to reduce layout shifts.
  • Test responsive image sources at narrow and wide breakpoints and verify object-fit behavior.

How to diagnose it

  • Compare the source image dimensions with its rendered width and height at each responsive breakpoint.
  • Inspect CSS from the image and its container; fixed width and height rules often override correct HTML dimensions.

How to fix it

  • Preserve the source ratio with an automatic dimension when the whole image must remain visible.
  • For intentional crops, give the container an explicit aspect ratio and use object-fit: cover so the image is cropped instead of stretched.

How to verify the fix

  • Test the image at narrow, medium, and wide viewports and confirm each srcset candidate renders at the intended ratio.
  • Reload with the network throttled and confirm reserved space prevents a layout shift before the image finishes loading.

Limits and false positives

  • Logos, SVG files, CSS background images, and art-directed picture sources may intentionally use different canvas dimensions.
  • Setting width and height attributes reserves space; responsive CSS can still scale the image while preserving that ratio.

Before

<img src="report.png" width="1200" height="800" class="square" alt="SEO report" />

After

<img src="report.png" width="1200" height="800" class="h-auto w-full" alt="SEO report" />

Related tasks

Reducing Render-Blocking Resources

In order for your website to work properly, you need to get rid of URLs that hamper the rendering process. Here are a few tips for you!

Monday, November 23, 2020

Heading Order: Fix Skipped Heading Levels

Use a logical H1-H6 hierarchy so people and assistive technology can understand page structure. Learn how to find and fix skipped heading levels.

Thursday, November 12, 2020

Reduce Excessive DOM Size

Statements made by Google underline one point: Document Object Model AKA web page should not be on excessive size.

Tuesday, October 27, 2020