Magento resize() image quality: dirty white background

前端 未结 7 1331
天命终不由人
天命终不由人 2020-12-29 13:38

I have a client who is seriously unhappy with the way their product thumbnails are rendering on Magento.

The dodgy appearance is noticeable on two accounts:

相关标签:
7条回答
  • 2020-12-29 14:00

    quick grep shows that you are able to set this on product_image object

    app/code/core/Mage/Catalog/Helper/Image.php:105:     * Set image quality, values in percentage from 0 to 100
    app/code/core/Mage/Catalog/Helper/Image.php:107:     * @param int $quality
    app/code/core/Mage/Catalog/Helper/Image.php:110:    public function setQuality($quality)
    app/code/core/Mage/Catalog/Helper/Image.php:112:        $this->_getModel()->setQuality($quality);
    app/code/core/Mage/Catalog/Model/Product/Image.php:38:    protected $_quality = 90;
    app/code/core/Mage/Catalog/Model/Product/Image.php:88:     * Set image quality, values in percentage from 0 to 100
    app/code/core/Mage/Catalog/Model/Product/Image.php:90:     * @param int $quality
    app/code/core/Mage/Catalog/Model/Product/Image.php:93:    public function setQuality($quality)
    app/code/core/Mage/Catalog/Model/Product/Image.php:95:        $this->_quality = $quality;
    app/code/core/Mage/Catalog/Model/Product/Image.php:100:     * Get image quality
    app/code/core/Mage/Catalog/Model/Product/Image.php:106:        return $this->_quality;
    app/code/core/Mage/Catalog/Model/Product/Image.php:331:                'quality' . $this->_quality
    app/code/core/Mage/Catalog/Model/Product/Image.php:387:        $this->_processor->quality($this->_quality);
    
    0 讨论(0)
  • 2020-12-29 14:01

    Upload the images as PNG's. They may not be as small as JPG, but it allowed us to avoid some image quality issues created by Magento's resizing functionality.

    0 讨论(0)
  • 2020-12-29 14:04

    I had the same issue with some of my images, later i realized that those images with lower resolution were getting distorted, try using an image more than 1100 X 1100 and it should work just fine !

    0 讨论(0)
  • 2020-12-29 14:06

    I had problems with images quality on one of projects. But the problem was not on back-end, but on the front-end. Images had bad quality because images width and height given in the CSS was not the same as the image file had.

    0 讨论(0)
  • 2020-12-29 14:15

    You can put your own Gd2.php file in local (app/code/local/Varien/Image/Adapter/Gd2.php) and hard-wire the quality to 100%.

    Quality is working for me so I have not done that.

    You can also put an image convolution in there to sharpen your images, in that way you get the blur of a resize compensated for with a sharpen, e.g. put the following just inside the end of the 'resize' function:

        $sharpenMatrix = array(array(-1,-1,-1),array(-1,24,-1),array(-1,-1,-1));
        $divisor = 16;
        $offset = 0;
        imageconvolution($newImage, $sharpenMatrix, $divisor, $offset);
    
    0 讨论(0)
  • 2020-12-29 14:16

    try following example

    echo Mage::helper('catalog/image')->init($product, 'small_image')->resize(180, 210)->setQuality(50);
    
    0 讨论(0)
提交回复
热议问题