This problem is specific to already well compressed jpegs. When Magento is re-saving them to the cache, it increases the file size. In some cases almost doubling the size compared to the original. Obviously, the bigger the image, the greater the problem in absolute terms (of lost bandwidth/ performance).

This is somewhat infuriating! How can I stop Magento messing with my images; and why on earth is it adding pixel data?!

I’m only allowed to post links to one example. However, I could pick any image, it is increasing them all:

Original Image - https://www.logsdirect.co.uk/media/catalog/product/p/e/peat-pallet-french-bottom_1.jpg (75 KB)

Cached version - https://www.logsdirect.co.uk/media/catalog/product/cache/1/image/9df78eab33525d08d6e5fb8d27136e95/p/e/peat-pallet-french-bottom_1.jpg (137 KB)


3 Answers 3


Magento always re-render images for caching. In Class Mage_Catalog_Model_Product_Image there is an attribute called $_quality declared to 90.

Simply add in template where the helper is instantiated the Method setQuality($value). e.g.

$_img = '<img id="image" src="'.$this->helper('catalog/image')->setQuality('70')->init($_product, 'image').'" alt="'.$this->escapeHtml($this->getImageLabel()).'" title="'.$this->escapeHtml($this->getImageLabel()).'" />';

Value needs to be between 0 and 100 as declared in Varien_Image_Adapter_Abstract Line 216-228.

hope that helps.

appendum: The Value is representing the grade of compression.

  • 1
    This is a useful starting point, thanks. But is there no easy way to stop Magento re-rendering my already compressed and optimised images?
    – invosoft
    Nov 30, 2014 at 17:28
  • i didn't find any place or code snippet where to do this.
    – tomtone
    Nov 30, 2014 at 17:30
  • Changing the $_quality variable works to a certain extent, thanks for that. However, I'm still not happy with the image rendering. Hopefully, someone will have a better solution..
    – invosoft
    Nov 30, 2014 at 17:45

Two ideas:

  1. just use the original image instead of the catalog/image helper
  2. Try Perfect_Watermarks to use imagick instead of GD

The following plugin has been recommended to optimise and compress all your Magento product cached images to get you great results in Google Speed Test. It allows you to integrate with several APIs like Resmush.it, ImageOptim, Kraken.IO to give you plenty of options to choose from


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.