Magento Tutorials

Magento Product Image Optimization


Optimizing images without losing their quality will certainly allow you to save more resources, speed up your Magento site, and create an amazing experience for your customers.
In this tutorial, we will show you how to optimize your Magento images.

You will need to run the compression on the files in /media/catalog/product/.

Here are some tools you should use: GIFSicle, JPEGTran, OptiPNG. These command lines will rewrite your current images to an optimized version without changing the filename. All cached images will also be optimized while you don’t have to refresh cache.

  • PNG images: Using OptiPNG
    optipng -o7 -strip all media/catalog/product/*.png
  • JPEG images: Using JPEGTran
    find media/catalog/product/ -name "*.jpg" -type f -exec jpegtran -copy none -optimize -outfile {} {} \;
  • GIF images: Using GIFSicle
    gifsicle --batch --optimize=3 media/catalog/product/*.gif

In short, run these command lines from your Magento root folder. It will optimize all your images automatically.

Besides, you should try to keep your image size around 70kb. There are some tools to compress the images before upload them to your backend such as Tiny Image, and a good number of extension on Magento marketplace.

There is one more important thing while optimizing your Magento images. You should use right image format at right place: GIF format for small resolution files like logos, buttons, icons, simple graphics, symbols and animation, PNG-8 for simple color images (buttons, logos), PNG-24 for photos or complex images when you need transparency, and not afraid of large size, JPEG for photos as it provides the best quality & the smallest file size.

Hope this helps!


Related post: Magento optimization technique for image, sql, cache – Step by step

Rate this post


A knowledge craver who always strive to be wiser everyday.

    1 Comment threads
    0 Thread replies
    Most reacted comment
    Hottest comment thread
    1 Comment authors
    Andrew Collins Recent comment authors
    newest oldest most voted
    Notify of
    Andrew Collins
    Andrew Collins

    I had a few problems with minifying js. My theme did not respond well to the changes and i am not sure if buying a new theme will help or not. I have a developer at magewares whom I am working with and he suggests me to get the theme customized but I have also been thinking of buying a new one. What do you think I should do?