Woman optimizes WordPress settings to prevent generating multiple image sizes

How to Prevent WordPress From Generating Image Sizes

When you upload an image to WordPress, it generates three image sizes by default (thumbnail size, medium size, and large size). However, there may be times when you want to use custom WordPress image sizes, either for design purposes or to manage your site’s performance.

While WordPress compressing images automatically is meant to be a convenience, it can end up creating too many files that take up unnecessary storage, and lead to backups that are too large. Fortunately, there are steps you can take to prevent this from happening.

In this post, we’ll answer the question: “Why does WordPress resize my images?” We’ll explain why you might want to stop WordPress from generating multiple WordPress image sizes, and show you how to do it. Let’s get started!

Why WordPress Generates Image Sizes and How to Prevent It

Put simply, WordPress automatically resizes images to help you save bandwidth and prevent you from having to manually resize images. For example, the image size you would use for a post thumbnail is much different than what you would use for an image slider on your home page. By generating additional image sizes, WordPress makes it easier for you to select the most appropriate option for each use case.

What Are the Standard Image Sizes For WordPress?

Every time you upload an image to WordPress, it creates three new versions, giving you four total sizes. The default image sizes are:

  • Thumbnail size – 150 x 150 pixels
  • Medium size – 300 x 300 pixels (maximum)
  • Large size – 1024 x 1024 pixels (maximum)
  • Full size – Original image size

WordPress image sizes are tiered in this way to simplify web design. There’s no need for you to manually resize a photo or graphic for use as, say, a featured image—the correct image size already exists within WordPress.

When to Stop WordPress From Generating Different Image Sizes

In addition to the different image sizes generated by WordPress, your theme may also create copies or additional image sizes, such as for a home page slideshow or featured posts. This redundancy can present issues, such as causing your backups to take longer or your pages to load more slowly.

For that reason, there are times when preventing WordPress from generating different image sizes is beneficial. If you’re looking to save space, have an image-heavy website such as a real estate or photography site, or simply aren’t using all of the different image sizes that are being created, you may be adding extra bulk to your site for no reason.

How to Stop WordPress From Generating Different Sized Image Copies

Now that you understand why WordPress generates multiple image sizes, and why it makes sense to prevent it from doing so, it’s time to get to work. Let’s take a look at how to stop WordPress from generating different image sizes in six simple steps.

Step 1: Connect Your Site to an FTP Client (To Determine How Many Images Copies Are Being Made)

The first step is to figure out how many copies WordPress is generating when you upload an image. You can do this by connecting to your site via a FileTransfer Protocol (FTP) client or your cPanel’s file manager.

As we mentioned earlier, WordPress generates three copies by default. However, your theme may also create its own set of image sizes for sliders, etc. So it’s important to know exactly what copies are being generated.

Step 2: Upload an Image to Your Site

Next, upload an image to your site from your WordPress dashboard admin area and open the media library (Media > Add New).

Click on Select Files, and then choose the image file to upload.

Step 3: Navigate to Your Site’s Upload Directory

Within your File Manager or FTP client, navigate to your site’s ‘upload’ directory. This will be located within the wp-contents folder. There, you’ll find all the copies of your existing images, which are organized by date:

At the least, you should find the three image sizes generated by WordPress. If there are more than three, they are likely the copies created by your WordPress theme (in our example above, there are five copies in total).

Step 4: Set Image Sizes to Zero

Next, navigate to Settings > Media in your WordPress admin dashboard.

There, you’ll find the default image settings:

Change each of the values for the image sizes to 0 (assuming that they are all ones you won’t be using). Select the Save Changes button at the bottom of the page when you’re done.

Step 5: Open the functions.php File of Your WordPress Theme

You’ve now stopped WordPress from generating multiple copies of the existing images you upload. However, you may also need to stop your theme from doing the same thing.

To do that, navigate to the functions.php file for your WordPress theme.

You’ll find this in the /wp-contents/themes/ folder of your website’s directory. 

Step 6: Delete the Default Image Size Code 

Once you’re in the functions.php file, look for any lines of code that are similar to this one:

add_image_size( ‘homepage-thumb’, 200, 160, true );

Depending on the theme you’re using, there may be multiple versions of this line. You’ll also want to look for any that say “set_thumbnail_post_size”. Remove these lines, and then save your changes.

How to Stop WordPress From Compressing Images

Along with preventing WordPress and your theme from generating multiple images sizes, you can also prevent them from compressing images. While compression is meant to enhance performance without reducing quality, this isn’t always the case.

With that in mind, here’s how to stop WordPress from compressing and cropping images in three simple steps.

Step 1: Open the functions.php File

If you want to disable WordPress image compression, the first step is to locate and open your theme’s functions.php file. Again, you can do this by connecting to your site via an FTP client, or by accessing your cPanel’s File Manager. 

Step 2: Modify the Return Value to 100

After you locate and open the functions.php file in your theme directory, simply add the following line of code:

add_filter(‘jpeg_quality’, function($arg){return 100;});

You can also change the ‘return’ value to be less than 100 if you prefer.

Step 3: Save Your Changes

Once you’re done, save your changes. Now WordPress will stop automatically compressing images, and instead retain their original quality. Note that in order to see the effect take place, you’ll need to regenerate your thumbnails

How to Optimize WordPress Images

Optimizing images for the web involves reducing overall file size without reducing image quality. The ultimate goal is a site that loads faster; a speedy website improves SEO and attracts visitors.

The best way to optimize images for WordPress is to make adjustments before uploading. This process generally occurs in the Save or Export settings of your image editor (such as Adobe Photoshop or GIMP). Here’s a step-by-step checklist to follow:

Step 1: Reduce Image Dimensions

If your image is 2000 x 2000 pixels or more, it’s worth reducing the dimensions before uploading it to WordPress. Except for rare cases, a photo on your site doesn’t need to be that big. The final dimensions will depend on your use for the image, but dropping the height and width to at least 1200px is a solid start.

Step 2: Select Image Format

Because smaller file sizes are ideal, format choice is crucial. When saving your image, avoid high-quality TIFF files, as the size increases substantially.

Instead, stick to PNGs for logos and graphics, and JPEGs for photos. While JPEGs reduce image quality slightly, the result is unnoticeable on the web, and your image will load faster.

Step 3: Choose Compression Amount

Image compression capabilities vary by software. But most of the time, you’re looking for a dropdown or slider labeled Image Quality or Compression. You’ll typically see it when saving your photo.

Compression reduces the size of a file without sacrificing the quality. The more compression, the smaller the file. Choosing a lower number for Quality performs the same function. 150KB or below is a safe end goal for image optimization.

Image Optimization Plugins

Alternatively, you can use a WordPress plugin to optimize your images upon upload. Options like Smush or EWWW Image Optimizer allow you to control image sizes with ease.

Keep Your Site Optimized With WP Engine

By default, WordPress automatically generates multiple image sizes during the upload process. However, when you’re using a theme or plugins that also create copies of your images, this can lead to unnecessarily large backups and less disk space. Fortunately, you can stop WordPress from doing this by setting the default image sizes to zero in your media settings.

Of course, this is just one of the many ways you can optimize your WordPress site. If you’re looking to enhance the entire digital experience, learn how our best-in-class WordPress hosting can help you take your online presence (and your customers) to the next level!

Get started.

Build faster, protect your brand, and grow your business with a WordPress platform built to power remarkable online experiences.