Magento: Image resize/compression reduces quality of JPEG
In Magento, image quality is distorted when it’s resized in Category page as well as Product page. This is very bad if you are running an eCommerce website because image is the only thing which gives best impression to your customers. There are several complains regarding this in Magento forums with different answers. Some even suggest to use ImageMagick over the default Gd2 library.
If you don’t want to switch to ImageMagick and also don’t want to do much changes, here is a simple solution.
1.) Copy app/code/core/Mage/Catalog/Helper/Image.php
2.) Paste it in local (app/code/local/ , create directories Mage/Catalog/Helper if it’s not there)
So the final structure will be app/code/local/Mage/Catalog/Helper/Image.php
3.) Edit newly pasted Image.php’s init() method, just after it sets “watermark size”, add a line:
$this->setQuality(100); |
4.) Save, flush image cache, run any category or product page and see the difference!
Hope this helps!
6 Comments
Leave a comment to Istvan
Welcome to my Blog
Certifications
Honor
Recognition
Contributions
Categories
- Apache (2)
- ChatGPT (1)
- Domain name (2)
- eCommerce (2)
- htaccess (1)
- Humor (3)
- Instagram API (1)
- jQuery (4)
- JSON (1)
- Linux (10)
- Magento (142)
- Magento admin (58)
- Magento Certification (5)
- Magento error (13)
- Magento frontend (68)
- Magento Imagine (2)
- Magento Interview (5)
- Magento Master (2)
- Magento2 (10)
- Mobile (1)
- MySQL (7)
- OpenAI (1)
- OroCRM (2)
- Performance (2)
- PHP (8)
- Prototype JS (3)
- Security (4)
- Wordpress (3)
- XML (2)
Thanks kalpesh!
It works for me 🙂
Thank you for instructions. Could you please elaborate on exactly where to add this line? I have found several places in image.php where there is a reference to set the watermark size.
Can you show us exactly where to paste this?
you are the best! thank you!
How about PNG photos? Specifically, watermarks? Cause by default it makes it in horrible quality.
Hi Dmitrii, it should work as well with the watermarks