How LCP Counts an Upscaled Image in Core Web Vitals
For LCP (Largest Contentful Paint) in Core Web Vitals, an image displayed larger than its original size is counted not by its on-screen area but up to its intrinsic pixel count. If you place a small image stretched to the full width at the top of a mobile page, the LCP element can become the text below it instead of the image. On the page I tested, a 200×113 image stretched to 412px wide was counted with a size of 22,600, and when I placed a paragraph below it, the paragraph (37,240) became the LCP element.
The test environment is Ubuntu 24.04, Node.js 22, Chromium 157 via Playwright 1.63.0, web-vitals 6.2.3, and ImageMagick 6.9.12. The viewport matches the mobile settings in Lighthouse 13.6.0's constants.js, 412px wide and 823px high. I used a DPR of 1.75 as the baseline and also measured at 1 and 3. size is the value of the largest-contentful-paint entry that PerformanceObserver received in the page. The pages were served without caching from a small server I ran locally (localhost:8080). The images are patterns drawn with ImageMagick with noise added, not real photographs. I did not test Lighthouse, PageSpeed Insights, real phones, real user data (field data), browsers other than Chrome, video poster images, or SVG images.
- 1. The Rule in the Spec: Divide by the Scale Factor
- 2. Sizes Measured for Different Display Methods
- 3. Two Display Methods That Did Not Match the Spec Calculation
- 4. DPR and srcset 2x Had No Effect on Whether an Image Counted as Enlarged
- 5. When a Small Image Is Stretched, the LCP Element Moves to the Text
The Rule in the Spec: Divide by the Scale Factor
The way LCP size is calculated is described in "Determine the effective visual size of an element" in the W3C LCP spec draft (index.bs). For images, the steps are roughly as follows.
- Multiply the width and height of the visible part of the image content, each rounded up to an integer.
- Divide the area of the box that displays the image (including any part that extends outside the screen) by the image's original width × height to get the scale factor.
- Only when the scale factor is greater than 1 (the image is enlarged), divide the area from step 1 by that scale factor.
An image shown smaller than its original size is counted by the area it actually occupies. An enlarged image has its visible area divided by the scale factor, so if the whole image is visible on screen, size is exactly its original pixel count. The web.dev LCP article also says that when an image is displayed at a different size than its original, the smaller of the display size and the original size is used as the LCP size.
Sizes Measured for Different Display Methods
The page had a small heading and a single image. For example, the body of the page where a 200×150 image is displayed at twice its size in both directions is shown below.
<h1>猫の手日記</h1>
<img src="/img-200x150.jpg" style="width:400px;height:300px" alt="">
I opened pages that changed only the way the image was displayed on a screen with a DPR of 1.75 and read the size values. sizes.cjs is a small script that outputs the LCP entry, the displayed size of the element (in CSS px), and naturalWidth and naturalHeight. Below is part of the output.
$ node sizes.cjs 1.75 same-size upscale-2x downscale stretch-x transform-2x object-fit-cover object-fit-contain upscale-half-out background-cover
chromium 157.0.8103.78 viewport 412x823 dpr 1.75
same-size: box(CSS px)=200x150 naturalWidth x naturalHeight=200x150
lcp entry size=30000 element=img url=img-200x150.jpg
=> LCP element=img size=30000
upscale-2x: box(CSS px)=400x300 naturalWidth x naturalHeight=200x150
lcp entry size=30000 element=img url=img-200x150.jpg
=> LCP element=img size=30000
downscale: box(CSS px)=400x300 naturalWidth x naturalHeight=800x600
lcp entry size=120000 element=img url=img-800x600.jpg
=> LCP element=img size=120000
...
Here is the result in a table. "Visible area" is the area where the image content is visible on screen.
| Display method | Original image size | Visible area | size |
|---|---|---|---|
| Original size (200×150) | 200×150 | 30,000 | 30,000 |
| Enlarged to 2× both ways (400×300) | 200×150 | 120,000 | 30,000 |
| Stretched 2× horizontally only (400×150) | 200×150 | 60,000 | 30,000 |
| Shrunk for display (400×300) | 800×600 | 120,000 | 120,000 |
object-fit: contain in a 400×400 box |
200×150 | 120,000 (400×300) | 30,000 |
object-fit: cover in a 400×400 box |
200×150 | 160,000 | 30,000 |
| Enlarged 2×, with the bottom half moved off screen | 200×150 | 60,000 (400×150) | 15,000 |
background-size: cover on a 400×300 element |
200×150 | 120,000 | 30,000 |
Shown 2× with transform: scale(2) |
200×150 | 120,000 | 120,000 |
For most enlarged images, size was 30,000 (200×150). Even with the same 400×300 display size, the page with the 800×600 image shrunk for display had 120,000. When the display size is the same, a smaller original image is counted as one quarter of the size for LCP.
The page with the bottom half moved off screen had 15,000. That is the visible 400×150 area (60,000) divided by the scale factor of 4 (400×300 ÷ 200×150). When less of the image is visible, it is counted as even smaller than its original pixel count. Background images (background-image) were also counted as smaller by the amount they were enlarged, just like <img>.
Two Display Methods That Did Not Match the Spec Calculation
For the object-fit: cover page, applying the spec steps gives 22,500. When a 200×150 image is placed with cover in a 400×400 box, the image content grows to about 533×400, and the left and right sides overflow and are cut off. Dividing the visible 160,000 by the scale factor that includes the overflowing part (533.3×400 ÷ 30,000 ≈ 7.1) gives 22,500. Chromium 157 reported a size of 30,000, which matches the original pixel count.
For the page shown 2× with transform: scale(2), size was 120,000. The spec includes the element's transform when computing the scale factor, so following the steps would give 30,000. In Chromium 157, enlargement by transform did not reduce size.
Both results are from Chromium 157 and do not match the calculations in the spec draft. Other browsers and other versions need to be measured separately.
DPR and srcset 2x Had No Effect on Whether an Image Counted as Enlarged
I opened pages where an image spanned the full width of the screen on screens with DPR 1, 1.75, and 3. The original image sizes were three: 200×113, 412×232, and 824×464. I also made one more page where a 412×232 image was specified with srcset="/img-412x232.jpg 2x". On this page, naturalWidth and naturalHeight are 206×116.
$ node sizes.cjs 3 hero-200 hero-412 hero-824 hero-412-2x
chromium 157.0.8103.78 viewport 412x823 dpr 3
hero-200: box(CSS px)=412x233 naturalWidth x naturalHeight=200x113
lcp entry size=22600 element=img url=img-200x113.jpg
=> LCP element=img size=22600
hero-412: box(CSS px)=412x232 naturalWidth x naturalHeight=412x232
lcp entry size=95584 element=img url=img-412x232.jpg
=> LCP element=img size=95584
hero-824: box(CSS px)=412x232 naturalWidth x naturalHeight=824x464
lcp entry size=95584 element=img url=img-824x464.jpg
=> LCP element=img size=95584
hero-412-2x: box(CSS px)=412x232 naturalWidth x naturalHeight=206x116
lcp entry size=95584 element=img url=img-412x232.jpg
=> LCP element=img size=95584
At DPR 1 and 1.75, size was the same as shown here. On the DPR 3 screen, the 412×232 image is stretched three times in device pixels, but size is 95,584, the same as its 412×232 display size. Whether an image counts as enlarged was determined by comparing its displayed size in CSS px with its pixel count, not by the device pixels on screen.
For the page specified with srcset 2x, size was also 95,584, the same as the 412×232 display size. Compared with naturalWidth and naturalHeight of 206×116, it is displayed at twice its size, but size did not decrease.
When a Small Image Is Stretched, the LCP Element Moves to the Text
I checked this on a page with a four-line paragraph placed under an image that spans the full width of the screen.
<h1>猫の手日記</h1>
<img src="/img-200x113.jpg" style="display:block;width:100%;height:auto" width="200" height="113" alt="">
<p class="lead">きょうは朝から雨でした。窓の外を見ながら、猫と一緒にのんびり過ごしています。……</p>
On the page with the 200×113 image, the LCP element was the paragraph (size 37,240). The image occupies 412×233 on screen, but on the same page without the paragraph, its size was 22,600. Since that is smaller than the paragraph's 37,240, the paragraph becomes the LCP element. On the pages with the 412×232 and 824×464 images, the image (95,584) was the LCP element. The following image shows two pages captured on a screen with DPR 1.75, with the LCP element outlined in pink.

With the network and CPU slowed down (latency 562.5ms, download 1,474.56Kbps, CPU 4× slower), I measured the LCP time five times each with onLCP from web-vitals. timing.cjs is a script that outputs the LCP value, the LCP element, and the time the image finished loading (image responseEnd in the output).
$ node timing.cjs 5 hero-200-text hero-412-text hero-824-text
chromium 157.0.8103.78 viewport 412x823 dpr 1.75 latency 562.5ms down 1474.56Kbps cpu x4
hero-200-text run1: LCP=676ms target=html>body>p.lead image responseEnd=1177ms
...
hero-200-text median: LCP=672ms image responseEnd=1171ms
hero-412-text run1: LCP=1244ms target=html>body>img image responseEnd=1235ms
...
hero-412-text median: LCP=1244ms image responseEnd=1235ms
hero-824-text run1: LCP=1516ms target=html>body>img image responseEnd=1505ms
...
hero-824-text median: LCP=1516ms image responseEnd=1505ms
The page with the 200×113 image had the shortest median LCP of the three, at 672ms. However, that is the time the paragraph was displayed. The image, which is the largest visible item on screen, finished loading at 1,171ms, and that time does not appear in the LCP value.
When a small image is stretched, the LCP element can move from the image to the text, and the LCP number can improve. The image itself does not appear any sooner, and it is displayed blurry. If you only look at the LCP value and shrink the image, you will not notice this difference.
You can see what the LCP element changed to by checking the attribution. In the attribution build of web-vitals, it appears in attribution.target. With PerformanceObserver, it appears in each entry's element and size. In the timing.cjs output above, target was p.lead.





