3

Joomla 3.9.21

I am working on a site that is very image heavy, most images are within the EasyBlog component and amount to approximately 8GB, the original administrators didn't optimise the images for web when uploading them.

I need to compress these images somehow so that they aren't taking up so much resources on the server, however I don't want to affect their dimensions or picture quality.

Rather than download all the images manually and bath process them in Photoshop and re-uplad I was looking for some ideas?

I know that Easyblog offer an image optimisation service but i'm wondering if I can somehow implement a similar reduction for free?

0

I'd go with a NodeJS approach because...why not, eh?

Step 1

Download all images and put them in a folder.

Step 2

Open your terminal (cmd, GitBash, etc) and navigate to your folder:

cd /path/my-folder

Step 3

Inside the folder, create a JS file (e.g compress.js) and add the following code:

const imagemin = require('imagemin')
const imageminWebp = require('imagemin-webp')
 
(async () => {
    await imagemin(['*.{jpg,png}'], 'compressed/images', {
        use: [
            imageminWebp({quality: 100})
        ]
    });
 
    console.log('Complete!')
})();

Step 4

Run the JS file

node compress.js

Step 5

Run the following

npm install imagemin imagemin-webp
3
  • This looks great @Lodder thanks - what sort of reduction would you expect from this? – jonboy Oct 7 '20 at 13:19
  • Well this converts the images to webp, which is a "next-gen" format, so you'll see quite a reduction. I'd suggest converting 1-2 images and adjusting the quality parameter, so you can guage the minimum. Please note I haven't tested this yet, so let me know if you run into any errors – Lodder Oct 7 '20 at 15:32
  • I will keep you updated - I have a few thousand images to process! – jonboy Oct 7 '20 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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