A hero image that is too heavy slows the whole page, and an AI-generated image at full resolution can be several megabytes. Google web.dev notes that photographic images suit lossy formats such as JPEG, WebP or AVIF, that vector formats suit logos and icons, and that a high-resolution raster image is needed for high-DPI screens. Measure the file weight, compare it with the page budget, and compress or resize the image until it fits.
What you need
- The AI-generated hero image
- The page weight budget, if one exists
- A way to measure the file size and the image dimensions
Step 1: Measure the file weight and dimensions
Read the file size in kilobytes and the pixel dimensions of the hero image. Note whether the image is larger than the space it will occupy on the page.
Step 2: Compare the weight with the page budget
Compare the file size with the page weight budget, or with a sensible target for a hero image on your site. If the image alone uses most of the budget, it is too heavy.
Step 3: Resize or recompress the image until it fits
Resize the image to the size it will be shown at, and export it in a format that suits its content, such as WebP for a photograph. Measure the file again and check it looks clean.
Worked example: synthetic file-weight check of one hero image
The table below is a synthetic example. It shows the expected result of checking one hero image; no image was published.
| Version | Dimensions | File size | Verdict |
|---|---|---|---|
| Original export | 4000 x 3000 | 2.4 MB | Fail – too heavy |
| Resized to 1920 px | 1920 x 1440 | 380 KB | Pass |
| WebP q80, 1920 px | 1920 x 1440 | 210 KB | Pass – best |
| Thumbnail size | 800 x 600 | 95 KB | Pass – too small |
Expected result (UNTESTED). the original export is 2.4 MB and fails, the resized JPEG passes at 380 KB, and the WebP version passes at 210 KB, so the WebP version is the one to use. This check was not run live; the table shows the expected result for the synthetic example.
Limits
- File weight is a guide, not a verdict: a light file with visible damage is worse than a heavier clean one.
- A hero image shown at a large size on a desktop can be shown smaller on a phone, so consider responsive images.
- Resizing an image down is safe, but resizing it back up loses quality, so keep the original.
- The page budget covers all images on the page, not only the hero, so check the total.
