Skip to content

Incorrect image size warning due to inherited devicePixelRatio during mobile emulation in Microsoft Edge DevTools #16766

@ma-5

Description

@ma-5

FAQ

URL

No public URL available. The issue was reproduced locally. I attempted to use CodePen for a minimal repro, but Lighthouse does not behave consistently in that environment (e.g. image rendering and emulation differ from local setup).

What happened?

Lighthouse incorrectly flags responsive images as “larger than necessary” during mobile emulation. Specifically, it inherits the devicePixelRatio from the host monitor (e.g. 1.5x) instead of simulating a mobile device with devicePixelRatio: 2. This causes Lighthouse to miscalculate the rendered image size and report false positives in the performance audit.

Example warning:

This image file is larger than it needs to be (744x496) for its displayed dimensions (558x372). Use responsive images to reduce the image download size.

What did you expect?

I expected Lighthouse to simulate a mobile device (e.g. Pixel 5) with devicePixelRatio: 2, and recognize that the @2x image is appropriate for a rendered size of 372px. The image is correctly served via a element with srcset and media queries, and should not be flagged as oversized.

What have you tried?

Verified the image logic using DevTools with Emulate devicePixelRatio: 2.

Confirmed that the image is rendered at 372px on mobile and served at 744px for Retina screens.

Used a proper element with srcset and media queries for mobile and desktop.

Reproduced the issue consistently on a monitor with devicePixelRatio: 1.5.

How were you running Lighthouse?

Chrome DevTools

Lighthouse Version

Unfortunately, I’m not sure which exact version I’m using. It’s the one bundled with Chrome DevTools in Microsoft Edge (latest stable version as of October 2025).

Chrome Version

Microsoft Edge 141.0.3537.71

Node Version

No response

OS

Windows

Relevant log output

No specific log output, but the warning appears in the “Performance” section of the Lighthouse report under “Properly size images”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions