HANIVVRA SUPPORT
Speeding up pages by using smaller images
Table of Contents
Large image files are the most common reason a page loads slowly, especially on phones. This guide shows how to make them smaller, by cropping, resizing, converting and compressing them, without making them look worse. Smaller images make pages load faster, which visitors notice and search engines reward.
What to do
- Crop to what matters. Cut away anything the page does not need, at the shape the layout uses: a wide 16:9 banner, a square portrait, and so on. Use Crop in the editor, with a fixed Ratio.
- Resize to the size shown. A photo straight from a camera or phone is often 4000 pixels wide or more, while even a full-width banner seldom needs more than about 2000. Use Resize with Fit within and Don't enlarge. As a guide: up to about 2000 pixels wide for full-width banners, 1200 to 1600 for images in the text, and 400 to 800 for thumbnails and cards.
- Use a smaller format. WebP is usually much smaller than JPEG or PNG at the same quality, and every current browser shows it. Convert photos to WebP. Keep PNG, or use lossless WebP, for logos, screenshots and graphics with sharp edges or transparency. A photo saved as PNG is often the biggest single saving: converting it to WebP can make it a tenth of the size.
- Compress. Use Optimize for images you keep in the same format. Lossless optimizing never changes how an image looks. Lossy optimizing saves more; use its comparison to check that the difference does not show.
To do many images at once, select them and use the bulk tools: Convert, Optimize, and Edit (which can also resize). Select one type at a time, all the JPEGs and then all the PNGs, for the most options.
When file names change
Converting gives a file a new extension: bakery.png becomes bakery.webp. Pages that show the old name keep showing the old file, or nothing, if it is deleted. Work in this order:
- Create the new files, and keep the old ones for now. Uploads and new files are live at once, while page changes wait for publishing, so deleting old files first would break the live site.
- Have your AI agent change the references, with a prompt like the one below.
- Review and publish.
- Only then delete the old files.
My CMS is at https://example.com. Its API is documented at https://hanivvra.com/support/api/ and my API credentials are in credentials.json. I converted some images, and their file names changed:
/images/bakery.png -> /images/bakery.webp
/images/team.jpg -> /images/team.webp
First check that each new file exists, with an HTTP HEAD request to its address. Then find every reference to the old names in the site's pages, headers, footers, error pages, form response pages and CSS files, including src, srcset, href and url() in CSS, and change each to the new name. If a new file does not exist, leave its references unchanged and tell me. Change nothing else. Then list every change you made.
The agent cannot see your files, so list each old and new name yourself. Copy relative URL, on a file's right-click menu, gives the exact address.
When an image's size or shape changes
Pages often give an image's width and height, so the page does not jump while it loads, and stylesheets sometimes give an image or its frame a fixed size or shape. After you crop or resize, those numbers can stretch or squash the new image. Have the agent check them:
My CMS is at https://example.com. Its API is documented at https://hanivvra.com/support/api/ and my API credentials are in credentials.json. I cropped or resized these images, and they now have new sizes:
/images/bakery.webp is now 1600 x 900 (it was 2400 x 1800)
/images/team.webp is now 800 x 800 (it was 1200 x 900)
Download each image and read its real size from the file, in case it differs from what I wrote. Find every place these images are used. Update the width and height attributes of each <img> to the new size, or to the same proportions where it is shown smaller. Check the CSS that styles them or their containers for fixed widths, heights or aspect-ratio values that no longer match, and adjust them so nothing is stretched, squashed or cropped by mistake. Change nothing else, and list every change you made.
Then review the changed pages in Publishing, and publish them. The AI prompt playbook has a ready-made prompt that does both jobs at once.
