Optimize Images Resizing


If you were ever annoyed about the way WordPress handles images resizing, this is a plugin for you.

What this plugin does is it optimizes the image handling in such a way that images are resized only when they are actually needed. What that means is that if your plugins/theme define a lot of image sizes, none of them will be generated on the image upload (like they would be usually), but only if they are actually requested in that size.

Resizing is done only once, images are later normally served by WordPress, so there is no performance hit.

Plugin also includes a method for removing all of the previously generated image sizes (useful when you install this plugin on a site with a lot of existing media).

TO REMOVE image sizes generated prior to activating the plugin, visit the ‘Tools -> Remove image sizes’ and use the button to perform the cleanup.

Other than that, you don’t need to do anything, plugin works silently in the background.

To sum up:

  • Resize images only when needed
  • Clean up existing images sizes
  • No performance hit
  • Free up your hosting space


  • Admin UI added by the plugin.
  • Difference between before and after running the plugin under a default theme (Twenty Sixteen).


  1. Upload optimize-images-resizing folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. (optional) Visit ‘Tools -> Remove image sizes’ to clean up your media folder
  4. ???
  5. Profit


I just installed the plugin. Is there anything else I need to do?

Is this a new site with no existing images? If the answer is yes, then there is nothing else you need to do, any uploads that happen after you activated this plugin will be automatically cleaned up. If the answer is no, keep reading.

How to clean up existing images?

Images can be cleaned up at any time by visiting ‘Tools -> Remove image sizes’ in your WordPress Dashboard. Simply click on the “Start new cleanup” button and wait for the process to finish (there is a visual feedback for the duration of the cleanup).

Some image sizes are not cleaned up, which ones and why?

Plugin never cleans default image sizes (thumbnail, medium, large), so if your theme/plugins don’t define custom image sizes, you don’t need this plugin. Why does it not clean up those image sizes? Well the reason for that is that all of those image sizes are used in the Media UI of the WordPress Dashboard. What that means is: if plugin were to clean up all sizes, they would be generated for all of your images as soon as you would visit the Media screen. Since I don’t know of anyone that never visits the Media screen, it made sense to exclude those image sizes from the cleaning process and avoid the redundant server load.

How do I know which files the plugin cleaned up?

A list of removed files is available only for the manual cleanup request, by checking the checkbox at the top of the plugin page. Once the request finishes, a message will appear stating how many images it removed. Click on the number to show the list of files that were removed in the process.

Are there any drawbacks to using this plugin?

Not that I know of. Your WordPress website will continue working as it did before, only your uploads folder will be a bit lighter (depending on the number of images and image sizes you have). It’s certainly useful during migrations!


Works perfect!

Very effective plugin! Removed a lot of generated image sizes that were not used at all but were included in the daily (off server) backup. Saves a lot of time, space and bandwidth.

why don’t use array of size?

Hello. Thanks for your code!

One question:

        public function image_downsize($out, $id, $size) {
            // we don't handle this
            if ( is_array( $size ) ) return false;

Why not?
For using: image_downsize($id, [200, 200])

Again – thanks.

Omg..Amazing plugin to the rescue!! 5/5

This works perfectly and is a life saver for big websites with lot of images and inodes usage shared hosting restrictions.
This should be core wordpress feature, I mean what’s the point to have 15 image sizes that your theme does not really use.
I don’t know exactly what sizes my theme template really uses, but this plugin finds automatically what is needed for display and removes the rest.
Most importantly, because it generates image size only on request, the resized images are affecting only the featured images (which are often requested at different sizes) and not my post images. Previously every single image in the post content would have 15 sizes, which would never going to be used because they were not featured.This fact alone saves the day for me.
Am I going to need more sizes for mobile visitors for the post content images? Probably yes, let the plugin handle only the absolute minimum required each time.

Unique functionality, works well ! [5/5]

Unique functionality, works well ! [5/5]
Be sure you understand what his plugin will do before you use it – I think it offers unique functionality that I have not seen in any other plugin.
I ran this on several small sites and it worked perfectly – removing a few hundred images and about 100MB in space.
This was as a test for my older, larger site – 5 years old, 300 pages, image heavy, lots of plugins and functionality.
Cleanup was successfully completed. Number of images removed: 10287. totaling 1.2GB ! (as per my cPanel usage stats).
However, one small thing did break – my Fullwidth Portfolio as slider (Divi WP theme) – strangely about half of the thumbnails disappeared from the front end slider. I went in to each project to edit/resave (all images were OK) but this did not fix. But no big deal – I just spent a few mins removing the fullwidth slider from my site, and will develop a new way of doing the same thing (as even re-creating the slider does not successfully pull in these missing thumbs.
So, a cautious recommendation, backup first, and you should be happy with the result.
Thanks for the great plugin, OriginalEXE. 5/5

For extra functionality, users may also want to check out the not-so obviously named:
– either EWWW – or – Smushit

This is now a default plugin in all my WordPress installations

Shouldn’t be necessary, but this plugin is removing an annoying WordPress problem. Why is Wordpess/template-makers taking the liberty and making 3-4 copies of my images and use those images instead of my carefully cropped and resized original image? Well, this plugin solves that problem. Thanks!

Read all 35 reviews

Contributors & Developers

“Optimize Images Resizing” is open source software. The following people have contributed to this plugin.


“Optimize Images Resizing” has been translated into Croatian. Thank you to the translators for their contributions.

Translate “Optimize Images Resizing” into your language.

Interested in development?

Browse the code or subscribe to the development log by RSS.



  • Fix a 1.4.0 PHP bug.


  • Move plugin to the Tools menu.
  • Add support for resuming image sizes removing.
  • Declare WordPress 4.7 compatibility.


  • Improve the plugin UI and UX by providing a more meaningful feedback (plugin will now tell you how many images it removed exactly and show the list of files that got removed).
  • Introduce WP-CLI support (props @charlesLF).
  • Fix issues with the plugin localization support.
  • Declare WordPress 4.5 compatibility.


  • Declare WordPress 4.4 compatibility.


  • Improve performance by returning the correct response after image is resized.
  • Improve performance by returning response immediately if image size is already found.
  • Avoid removing image sizes that are added via ‘image_size_names_choose’ filter (they get generated anyway on the Media screen).


  • Improve the process of removing unwanted image sizes on image upload (props @bcole808)


  • Declare WordPress 4.3 support


  • Fix compatibility issue in specific scenarios


  • Fix issue where cleanup process would get stuck on certain images.


  • Fix issue where default image size would not be generated after cleanup, if a custom image size of the same dimensions is defined.


  • Fix issue where full image size would be duplicated when width and height are both set to 0.


  • Fix issue with cleaning up images from media settings screen.


  • Plugin no longer removes any of the default WordPress image sizes.


  • Fixed issue where image sizes were not listed in some places inside admin area.


  • Fixed issue where images would be regenerated even when not needed.


  • Initial version.