To balance image quality and loading speed, first size images for their intended use, then choose a format, test compression levels, and finally check how the page loads. The goal is not to make every image as small as possible, but to reduce unnecessary downloads while preserving essential detail. web.dev notes that there is no universal compression setting for all images; the same settings will not necessarily keep photos, text-based images, and illustrations equally clear.
Decide how images will be displayed before resizing them
A small displayed image does not necessarily mean a small download. Yoast gives this example: if a 2500×1500-pixel image is displayed at 250×150 pixels but still uses the original file, the browser must load the entire large image. Changing only the display dimensions in CSS does not reduce the image file size.
- Consider thumbnails and enlarged views separately: product detail images may need larger dimensions, while list thumbnails can be much smaller.
- When resizing images for display, account for your readers’ devices and high-resolution screens rather than reducing every image to the same dimensions.
- Prepare versions in different sizes and use responsive images so browsers can choose an appropriate file instead of making every device download the same large image.
Choose a format to suit the image, rather than using one for everything
Yoast suggests considering WebP for large photos or illustrations, PNG when a transparent background needs to be preserved, and SVG for logos and icons that need to scale without losing quality. These are guidelines, not claims that one format is best in every situation or that only PNG supports transparent backgrounds.
AVIF is also worth comparing. Yoast notes that it can offer high quality and smaller files, but you should still check whether your readers’ browsers and devices support it before adopting it. You can provide WebP or JPEG fallbacks for browsers that do not support AVIF; web.dev also explains how to use the picture element to offer images in multiple formats for the browser to choose from.
Compress incrementally and base trade-offs on visible detail
Lossy compression removes some image data and can usually save more space than lossless compression. Lossless compression, by contrast, reduces file size without discarding data. Choose between them based on the image’s purpose, rather than treating the smallest possible file as the only goal.
- Use tools such as Squoosh or ImageOptim to try different compression levels, comparing both file size and image quality.
- Check important details, especially high-contrast colored text on solid backgrounds; web.dev warns that these images are prone to distortion from chroma subsampling.
- If you do not need to retain EXIF data, consider removing it to reduce file size further.
After compression, test the page’s loading performance with tools such as PageSpeed Insights. Check image quality as well as file size; a tool’s score cannot tell you whether an image is clear.
Preparing image files: perspectives from across the web
Do you still need to process images yourself when using WordPress?
You should still check image dimensions, along with quality and file size after compression. Yoast notes that WordPress automatically provides images in different sizes and compresses uploaded files, but its automatic compression is often not sufficient on its own. If the original image is much larger than needed, resize it for its intended use, then check the compression results. This can help avoid unnecessary downloads.
Should a photography portfolio prioritize loading speed?
Not necessarily. If the portfolio's main purpose is to showcase photographic detail, you can give image quality more weight rather than sacrificing how your work looks solely for speed test scores. The iThome example also reminds us that prioritizing quality does not mean ignoring speed. You can prepare smaller thumbnails so that readers load files suited to browsing the portfolio or viewing details.
Is there still room for compression if you must keep the JPEG format?
One option to consider is encoding JPEGs with Jpegli. Welly's introduction notes that Jpegli can save JPEGs at higher compression ratios, reducing bandwidth and storage requirements. Before adopting it, however, compare output file sizes and confirm that the compressed images meet your quality requirements.
Is embedding images directly in a web page always faster?
Not necessarily. Google notes that embedding images using data URIs can reduce HTTP requests, but these images can also substantially increase page size, so you need to choose carefully when to use this approach. Reducing the number of requests is only one consideration and does not mean that every image is suitable for embedding; you should still account for the increase in page size and test actual speed.
Where is image lazy loading appropriate?
Consider using it for less important images that are not yet visible on the reader's screen. This lets readers see important content before later images load and can reduce the work needed to load the page initially. Images differ in importance and position, however, so the same approach should not be applied to every image. Test actual page performance after making changes.
References
- 圖片搜尋引擎最佳化 (SEO) 最佳做法 | Google 搜尋中心 | Documentation | Google for Developersdevelopers.google.com — Discusses: Is embedding images directly in a web page always faster?; Where is image lazy loading appropriate?
- Image performanceweb.dev — Discusses: Is there still room for compression if you must keep the JPEG format?
- Google 新的 Jpeg 編碼函式庫-Jpegli 介紹welly.tw · 2024-04-26T08:44:38.219Z — Discusses: Is there still room for compression if you must keep the JPEG format?
- Image SEO: How to Optimize Images for Search Engines & Userswww.semrush.com · 2020-07-14T11:00:00Z — Source used in the article above.
- Lighthouse 和 PageSpeed,檢測網站該看哪個指標?ithelp.ithome.com.tw — Discusses: Should a photography portfolio prioritize loading speed?
- 圖片也可以提升網站曝光?圖片 SEO 必學 8 技巧!welly.tw · 2024-08-09T07:43:16.259Z — Discusses: Where is image lazy loading appropriate?
- Image SEO: Optimizing images for search enginesyoast.com · 2026-09-12T12:00:00+00:00 — Discusses: Do you still need to process images yourself when using WordPress?
- PageSpeed是什麼?會影響SEO嗎?網站測速工具這裡看!welly.tw · 2024-10-07T10:41:12.274Z — Discusses: Where is image lazy loading appropriate?
