My friend has a wordpress site but all of the original images are huge (some are 5meg each!).

I want to batch resize them but don't want to use a WordPress plugin (there are not any that do a sufficient job). I want to use Photoshop as that is what I know well. However, there are hundreds of folders and the structure is problematic. It is like this:


and 02, 03, 04 etc - through to 12 for each of the year folders

The batch job needs to;

A) Resize the image proportionally using maximums, so if the image is above a certain size, only then apply resize (max 1200 Width x proportional H ) and anything less, leave alone.

B) Save at 60% compression

C) Overwrite the originals (we have backups)

While attempting this task with Image Processor it works great, but seems can only do one folder at a time, and there are hundreds of folders. Although there is a "Include All Sub Folders" option it don't seem to be able to work correctly because although it works fine on the first image folder e.g. "01" (and makes its JPG folder for the save as it should), it starts to work on the JPG folder it just created - and gets stuck in an endless loop of JPG subfolders!

So I am thinking a batch process job might work, but how should I set it up ?

Any help appreciated.

  • 2
    use imagemagik.
    – joojaa
    Oct 5, 2022 at 5:55

3 Answers 3


If you are using Windows, IrfanView is free.

It can add all the images in a directory and subdirectories, batch resamples them. Save them in a copy of the original route and structure. You can apply additional sharpening, define the JPG compression, rename them or keep the same name, change file format, do not enlarge small images...

All the wishlists you have, are there.

I have not transformed 10,000 images at once. But a hundred. It would be interesting to test it.

enter image description here

I don't think is a good practice to overwrite the files. Just copy them and after you have finished, delete the originals.

  • Thank you however, I specifically wanted to use PS as that is what I know. I've answered the question now with how I did it - it worked out really great ! Oct 5, 2022 at 20:15

The best way to do it is through a premium plugin.

Wordpress has many plugins that automatic resizes the inserted images. They have compression settings as well.

There is no need to download the entire website, compress the files and then upload all the files unless you want to have a particular compression setting in mind.

Batch resizing takes some time. Make sure you have set it up corretly (ignore file opening errors or save the file on same location etc.)

  • Thanks but I don't want to use a plugin, I have PS and happy to use it, plus I have never found a good enough plugin that actually crops images correctly, then compresses them accurately. They all claim to do this, but none I have found actually do it well enough. Hence my desire to use PS - and I've already answered my own question as I found out how to do it. It has worked really great. Oct 5, 2022 at 20:14

OK I figured this out... for my future 'goldfish memory' self and for any one else out there who may find this useful, here's how to do it. Assuming the following:

  • you have Photoshop and a lot of JPGs in nested folders (in my case a WordPress Media folder of 10yrs with 10,000 images).

Image Processor doesn't work for nested folders, so instead, we will use Batch process. First you have to record the actions the batch process will follow. Open any random image, specifics don't matter, as long as it's a large JPG - this is just to "teach" PS what to do.

Go to window > Actions > Create New Set > Create New Action and press the record button and do the following:

  1. File > Automate > Fit Image [ set constrain sizes e.g. 1200 x 1200 ] AND make sure you tick "Don't Enlarge", so it will skip smaller images.

Note. the sizes here are the maximum that the resize will affect, it won't resize anything that is already smaller than this and secondly, these are maximum sizes, not the actual size it will crop to. Example; if you set 1200 x 1200 and your image is 1920 x 960, it will retain the existing profile because it crops proportionally - it won't "square it" at 1200 x 1200. This is important because in my case, I already had a huge range of sizes and profiles, and I only wanted to set the maximum a portrait or landscape size will be.

  1. Still in action record mode: Save As > set the "Image Options Quality" (I set mine to 6 = 60% ish, which will drastically reduce the file size when saved)

  2. Still in action record mode: Close the image (File > Close)

Now stop the recording - you should have three actions.

Fit Image Save As Close

Now for the fun part - go to File > Automate > Batch.

enter image description here

A) On the left side (called "Play"), you need to select the Set you created, then the Action folder you made where your actions are stored.

B) Select the Source as Folder and then choose the top level folder. In my case, I selected my "-uploads" folder (see original question) because I want PS to iterate through all of the sub folders, years and months.

C) Next there are four options, (see screenshot) I've ticked them as No \ YES \ YES \ YES Also, ensure to select " Log Errors to File" - and select a location - so we don't get interruptions.

In the Right Side "Destination" Make sure you select Save and Close, then tick "Override Action "Save As" Commands.

Leave everything else as it is. NOTE: this will OVERWRITE your original images - so you may wish to make a backup.

Now you are ready to run it. If you have thousands of images like me, it will take time, so go and have a swim ;-) paint the roof or watch telly with your cat.

Sadly, there is no "success" message when complete - yes, I expected a "congratulations" and fake screen fireworks, but maybe I'm showing my age here!

To check the outcome, simply navigate to the file folder and check the time stamp and image sizes (in Widows you can activate the column "date modified"). If they correspond with date/time when you ran it, they're processed successfully.

Another annoying thing is there's no "resume" function if it encounters an issue. Several times, the batch process borked for some unknown reason and I had to restart it. However one plus is it will skip all the images it's already done so should be a bit faster. I left this to run for a few hours and like magic it's all done!

Hope this helps someone!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.