During my last Magento project (Magento Version 1.4.1.0) I noticed the bad image quality of product images in the list view, detail view and also the zoom image. Usually show owners don’t care for loading speed and wanna show their products in high quality instead. Not with high image compression like Magento’s default setting.

The solution is simple if you know where the default setting is hidden:

1. Go to /app/code/core/Mage/Media/Model/File/Image.php
2. Copy Image.php to /app/code/local/Mage/Media/Model/File/Image.php
3. Go to line 174 in your Image.php and change the following code


Old setting with high compression:

$result = imagejpeg($object->getTmpImage(), $object->getFilePath(true), 80);

New setting with almost no compression:

$result = imagejpeg($object->getTmpImage(), $object->getFilePath(true), 100);

In this case 100 means 100% of the image quality. You could also enter 95 or 90 to get a smaller filesize.

4. Save Image.php and upload it to your server
5. Go to your Magento backend System -> Cache Management and clean your image cache and all Magento cache


No Comments on “Magento Image Compression Solution”

You can track this conversation through its atom feed.

No one has commented on this entry yet.

Einen Kommentar hinterlassen

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>