WordPress Speed Optimization 5 min read

Converting WordPress Images to WebP Without Losing Quality

The Client Expectation: All Images Should Be WebP

What Clients Assume vs What Actually Happens

When a client agrees to image optimization as part of a WordPress speed project, they typically assume the result will be simple: all images on the website become WebP, the site gets faster, and the old JPG files go away. The reality is more nuanced, and setting accurate expectations at the start of the project prevents confusion later.

LiteSpeed Cache’s image optimization service does convert images to WebP, but it works by creating WebP versions alongside the original files rather than replacing them. The original JPG or PNG files remain on the server as backups. The plugin then serves the WebP version to browsers that support it — which is all modern browsers — while falling back to the original for older browsers. From the client’s perspective, the website serves WebP. From the server’s perspective, both versions exist.

Why the Media Library Still Shows JPG

After running LiteSpeed’s image optimization, clients often notice that the WordPress media library still displays JPG files. This causes confusion because the optimization appears to have done nothing. In fact, LiteSpeed’s optimization works at the file delivery layer — the server intercepts image requests and substitutes the WebP version transparently. The media library continues to reference the original file, but the browser receives the WebP version.

This can be verified using browser developer tools. Open the Network tab, filter by image type, and reload the page. The Content-Type header for each image will show image/webp if the optimization is working correctly, regardless of what the media library displays.

Running the Optimization: Step by Step

Initial Image Optimization Request

Navigate to LiteSpeed Cache in the WordPress admin, then open the Image Optimization section. Click Send Optimization Request to queue all existing images for processing. The optimization service will process images in batches — large media libraries can take several hours to complete. The dashboard shows progress including images retrieved, total reduction, and timestamps for the last request and retrieval.

Do not interrupt the process by clicking Send Optimization Request multiple times. If the queue appears stalled, use the Refresh button in the dashboard to update the status. The Automatically Request Cron option will handle subsequent batches without manual intervention once it is enabled.

Handling Manually Uploaded WebP Files

If WebP images were manually uploaded to the media library before running LiteSpeed’s optimization service, those images will appear in the media library without alt text or other attachment metadata — because they were uploaded as raw files rather than through WordPress’s normal media upload process. These manually uploaded WebP files should be removed and replaced with the originals, allowing LiteSpeed’s optimization service to handle the conversion correctly.

Image Quality After Conversion

Will Images Still Look Good?

LiteSpeed’s image optimization service uses lossy compression with quality settings that preserve visual quality for most types of photography. The compression is more aggressive on areas of flat color or smooth gradients and less aggressive on areas of fine detail. For the travel and walking route photography typical of content-heavy websites, the visual difference between the original JPG and the optimized WebP is not detectable at normal viewing sizes.

If image quality is a priority — for example, on a photography portfolio or a website where image fidelity is part of the brand — test the optimization service on a small batch of representative images before running it across the entire media library. Compare the original and optimized versions at full size and confirm that the quality meets the client’s standard before proceeding.

What to Do If Quality Is Not Acceptable

If the WebP quality is not acceptable, LiteSpeed Cache provides an option to revert to the original files using the Use Original Files option in the Image Optimization section. This switches delivery back to the original JPG or PNG versions without deleting the WebP files. The WebP files can then be deleted using Destroy All Optimization Data if needed.

Switching Between Original and Optimized

Use Original Files vs Use Optimized Files

The Image Optimization dashboard includes two toggle options: Use Original Files and Use Optimized Files. These allow switching between the original and WebP versions site-wide without deleting either set of files. This is useful for demonstration purposes — showing a client the difference in page load time between the original and optimized versions — and for quick rollback if a problem is discovered after optimization.

For New Images After Optimization

Images uploaded to WordPress after the initial optimization run are not automatically optimized. They will be served in their original format until they are included in a new optimization request. For ongoing maintenance, enable Automatically Request Cron in the image optimization settings. This will check for new unoptimized images on a schedule and queue them automatically, without requiring manual intervention each time new content is uploaded.

The next article covers a specific problem that surprises many developers: why WordPress-generated thumbnail sizes often remain as JPG even after a successful WebP conversion, and what to do about it.

This article is part of our complete guide:

WordPress Speed Optimization: A Complete Developer Guide

Read the full guide →
← Back to Blog Next Article →