How to Optimize Images for Website Speed
Step-by-step: optimize images for website speed with presets, correct dimensions, lazy loading, and copy-paste HTML tags.
The complete guide to the Web Image Optimizer: presets for hero, product, and card images, Core Web Vitals, and copy-paste HTML.
CompressMyPic Editorial Team · Published Nov 17, 2026 · 10 min read

A website is only as fast as its images. Text loads in milliseconds, but a single unoptimised photo can stall a page for seconds.
The Web Image Optimizer is built for that problem. It compresses images for specific website slots, then hands you the HTML to paste straight into your page.
This guide explains the presets, the settings, and how to use the tool to make a whole site faster.
Web optimisation means preparing an image for a specific job on a page. A hero image, a product shot, and a thumbnail each need different sizes and formats.
It covers four things: file size, dimensions, format, and HTML. Getting all four right makes the image load fast and look sharp.
File size decides download speed. Dimensions decide how the image fits its slot. Format decides compatibility and quality.
HTML decides how the browser treats the image. Lazy loading, width, height, and alt text all live in the tag, and they all affect speed and accessibility.
The optimiser handles all four together. That is what makes it different from a plain compressor, which only handles file size.
The tool offers five presets, each mapped to a real website slot. They set the dimensions, format, and quality in one click.
E-Commerce Product is the default. It caps images at 1200 pixels wide in WebP at 82 percent quality, which suits product photos perfectly.
Other presets cover hero images, cards, thumbnails, and social sharing. Each one matches the slot it is named for.
Presets are starting points, not prisons. You can customise any setting after picking a preset, mixing and matching to suit your page.
Start with the preset closest to your slot. Adjust from there only if the result does not suit the design.
Hero images fill the top of the page, so they matter most for first impressions and for Largest Contentful Paint.
A hero should be large enough to look sharp on wide screens, but no larger. An oversized hero wastes bandwidth on pixels nobody sees.
Use WebP for heroes on modern sites. It keeps the large image lighter than JPG at the same quality.
Never lazy-load a hero image. It is above the fold, so the browser should fetch it immediately, not wait for a scroll.
Preload the hero when you can. Telling the browser early about the most important image shaves real time off the first paint.
Product images sell the product, so they must stay sharp. The E-Commerce preset caps them at 1200 pixels, which suits most shop layouts.
Keep the background clean and the product centred. A tidy product shot compresses better and looks more professional.
Use consistent dimensions across the catalog. A grid of mixed sizes looks untidy, no matter how good the compression is.
WebP is ideal for product photos on modern shops. For marketplaces that demand JPG, switch the format and keep the same dimensions.
Check the product page on a phone after uploading. Most shoppers browse on mobile, and the image must look good there first.
Cards and thumbnails are shown small, so they need the least data. A 400-pixel image is plenty for a card that displays at 300 pixels.
Small images tolerate heavier compression. A thumbnail at lower quality still looks clean, because the display size hides the softness.
Lazy-load cards below the fold. They are not visible when the page opens, so the browser can fetch them later.
Keep the aspect ratio consistent across cards. A grid of mixed ratios looks messy and forces the browser to reflow the layout.
Thumbnails are where optimisation pays most. A page with twenty cards saves megabytes when each thumbnail is properly sized.
The Copy Image Tag button writes the full HTML for your optimised image. It includes the source, dimensions, alt text, and loading behaviour.
The alt text is generated from the filename or your description. Good alt text helps accessibility and search engines understand the image.
The tag includes width and height attributes. Those prevent layout shift, which is a Core Web Vitals metric that affects rankings.
Loading lazy is included for below-fold images. It tells the browser to wait until the image nears the viewport before downloading it.
Paste the tag straight into your page. It is ready to use, with no manual editing needed.
Lazy loading defers images until they are needed. It is one of the easiest speed wins on any image-heavy page.
Apply it to images below the fold. They are not visible when the page opens, so downloading them early wastes bandwidth.
Never lazy-load the hero or logo. Those are visible immediately, and delaying them hurts the first impression and the LCP score.
The optimiser adds loading lazy automatically for suitable presets. The hero preset leaves it off, which is the correct behaviour.
Test the page after adding lazy loading. Scroll down and confirm the images appear smoothly as they enter view.
WebP is the best format for most web images. It is smaller than JPG at the same quality and supports transparency like PNG.
JPG remains essential for compatibility. Email, social sharing, and older systems still prefer JPG, and the Social OG preset switches to it automatically.
PNG suits interface graphics, not photos. A logo or icon stays pixel-perfect in PNG, while a photo in PNG wastes bandwidth.
SVG is not handled by this tool. It is a vector format, and the optimiser works with raster images like JPG, PNG, and WebP.
When in doubt, use WebP for the site and JPG for sharing. The optimiser makes switching between them a one-click job.
The quality slider runs from 20 to 95 percent, not 0 to 100. That range is deliberate, and it protects you from bad choices.
Below 20 percent, images fall apart visibly. No website slot benefits from quality that low, so the tool does not offer it.
Above 95 percent, the file grows fast for almost no visible gain. The extra data preserves detail the eye cannot see.
Most presets sit between 75 and 85 percent. That range gives clean results at small file sizes for nearly every image.
Adjust the slider only when the preset result does not suit the image. A detailed photo may want 85, while a simple graphic is fine at 70.
Camera photos carry hidden metadata: GPS location, camera model, and settings. That data adds weight and leaks private information.
The optimiser strips EXIF and GPS data during compression. The downloaded file carries no record of where or when it was taken.
Stripping saves only a few kilobytes per image, but it adds up. Twenty images save a meaningful amount together.
Privacy is the bigger benefit. A photo published on a public site should not contain the location where it was taken.
For client work, stripping is essential. Unreleased products and private locations must not leak through image metadata.
You can optimise many images in one batch. Drop thirty blog images in, pick a preset, and download them all together.
Batch mode is ideal for site migrations. Moving a blog to a new theme means re-optimising every image, and a batch handles it in minutes.
Check a few results before downloading the whole batch. A single soft image can hide among good ones.
Keep the preset consistent across the batch. Mixed settings produce mixed results, which look untidy on the live site.
For exact file-size targets instead of presets, the target file size compressor takes any number you type.
When someone shares your page, the platform shows a preview image. That image is often the first thing a new visitor sees.
Open Graph images need specific dimensions, usually 1200 by 630 pixels. The Social OG preset sizes them correctly and switches to JPG.
Keep the file under a few hundred kilobytes. A heavy preview image loads slowly in the share card, and some platforms skip it entirely.
Test the share card before publishing. Every major platform offers a debugger that shows exactly how the preview will look.
A good share image is simple and bold. Text should be large, the subject should be centred, and the background should be uncluttered.
Retina screens pack more pixels into the same physical size. An image that looks sharp on a normal screen can look soft on a Retina display.
The fix is to serve an image twice as wide as its display size. A thumbnail shown at 400 pixels wide should be 800 pixels in the file.
The optimiser's presets account for this. A card preset produces an image that stays sharp on high-DPI screens without wasting bandwidth.
For small thumbnails, this matters little. For large feature images, the difference between standard and Retina-ready is visible.
Test on a real high-DPI screen when you can. Screenshots of the result hide the very softness you are trying to check.
Every web image needs alt text. It describes the image for screen readers and for search engines, and it shows when the image fails to load.
The optimiser generates alt text from the filename or your description. Edit it when the generated text does not describe the image well.
Write alt text as a sentence. Describe what the image shows, not what it is for, and keep it under about 125 characters.
Decorative images need empty alt text, not a description. A blank alt tells screen readers to skip the image entirely.
Good alt text also helps SEO. Search engines read it to understand the image, which can bring traffic from image search.
A content delivery network serves your images from servers near each visitor. That cuts download time, especially for a global audience.
Optimised images benefit most from a CDN. A small file served nearby loads almost instantly, while a large file served far away crawls.
Cache headers tell browsers to keep images locally. A returning visitor then loads the page without downloading the images again.
Set long cache times for images that rarely change. A logo or a product photo can safely cache for months.
Optimisation and delivery work together. A small image on a fast CDN beats a large image on a slow server every time.
Some older browsers cannot open WebP. Serving WebP alone would leave those visitors with broken images.
The picture element solves this. It lists WebP first and JPG second, and the browser picks the first format it supports.
Generate both versions of each image. The optimiser produces the WebP copy, and a JPG copy from the same preset serves as the fallback.
Test the fallback on an older browser or device. The JPG version should appear seamlessly, with no visible difference.
As WebP support grows, the fallback matters less. For now, it is cheap insurance against broken images.
Before and after numbers make the benefit concrete. Note the total image weight and the load time before optimisation, then measure again after.
A typical page drops from several megabytes to under one. That change shows up immediately in speed scores and in how the page feels.
Check the Core Web Vitals after optimisation. LCP should improve most, since the hero image is usually the largest paint.
Ask a colleague to load the page on their phone. A fresh device on a real connection is the honest test of your work.
Keep a simple record of the savings. When someone asks why images must be optimised, the numbers answer better than any argument.
For the hands-on steps, read How to Optimize Images for Website Speed. For the Core Web Vitals deep dive, see Image Optimization for Core Web Vitals: LCP and File Size. For simple size targets, the 200KB compressor covers most web images.
Step-by-step: optimize images for website speed with presets, correct dimensions, lazy loading, and copy-paste HTML tags.
How image optimization improves Core Web Vitals: LCP, CLS, and INP explained, with practical fixes for slow pages — compression, resizing, and formats.
Compare animated GIF, WebP, and MP4: file size, quality, compatibility, and when to use each format for animations on the web.
Step-by-step: compress any animated GIF for Discord, Slack, websites, and chat. Presets, palette, scale, and fixes for stubborn files.