4

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?

1 Answer 1

1

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
2
  • This looks great @Lodder thanks - what sort of reduction would you expect from this?
    – jonboy
    Commented Oct 7, 2020 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
    Commented Oct 7, 2020 at 15:32

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.