How to Replace Huge Image with Optimized Version the Easy Way

Sometimes, we need to replace the original images because they are just way to big or not using the right format. We can do manual replacement with the optimized version. But consider this: the images were uploaded a long time ago. You may not know how many times they are used and in how many posts. With the help of a plugin, we can make this job a lot easier.

I have been working with WordPress website administration and maintenance for years. From time to time, I was asked to speed up the website page load time. After page speed test, I realized that there were some extra large images used on the website. To make it worse, the large images were in PNG format. For website usage, unless there are special needs such as using an image with transparent background, JPG is a better choice than PNG for its controllable compact size. There are enough resource can be found on the Internet about this comparison, I won’t spend time explaining here.

The tool I use for this job is Enable Media Replace, a free plugin can be downloaded from WordPress.org. The plugin can help you replacing the original large image with the newer optimized version. It can even replace the original file with a new file with different name, including anywhere it is used on the website. Let’s look at the how it performs:

In this example, I want to replace a PNG file with its JPG version. The screenshot shows how many different sizes created by WordPress and the physical file sizes.

I download the main file “Poster_NHL_THFM.pnp” and save a optimized version in JPG using Photo Shop. Then, I locate the original file in Media Library, hover file name, click on Replace media.

Next, we are asked to choose a file to replace the target media file.

There are 2 options:

  • Just replace the file
    To use this option, new replacement file must have exactly same type as the target file. Replacement file name can be different because it will be renamed to original.
  • Replace the file, use new file name and updated all links
    As option claimed, new file type and name will be used.

As I am going to replace PNG image with its JPG version, I choose the 2nd option. After replacement, the original image including its different size versions are removed from the website and replaced with new upload. Here is what I have: