Search code examples
image-processingpagespeedimage-compressiongoogle-pagespeed

Tools to compress images to pagespeed standard


I've been using Photoshop's "Save for web" option to save images that go on my website.

I keep the quality level at 60 which reduces picture quality slightly. When I increase the level pagespeed tells me that the images can further be compressed without loss.

I've also tried to do the same with Irfan View which has batch resize and compress which is great but results in the same pagespeed warning.

What can I do here? Is there any other tool I can use?


Solution

  • Your image is 182kB as you posted it. With ImageMagick, you could down-sample the chroma and reduce the quality like this for 144kB:

    convert ZtUUpS8.jpg -sampling-factor 4:2:2 -quality 75 result.jpg
    

    enter image description here

    Or, you could say you want an image no larger than 90kB like this:

    convert ZtUUpS8.jpg -define jpeg:extent=90KB result.jpg
    

    enter image description here

    You can copy each of those and try them before installing ImageMagick :-)


    Batch Processing

    Make a back up of your files first and work on a COPY of a small subset until you get the idea.

    If you are on Windows, and you want to do batch processing, you have two options:

    1. Use ImageMagick's mogrify command:

    mogrify -define jpeg:extent=90KB *.jpg
    

    2: Use Windows' FOR loop

    I don't use Windows, but there is a FOR loop described here, that would look something like this:

    FOR /F %%G IN (*.jpg) DO convert "%%G" -define jpeg:extent=90KB "%%G"