Skip to content Skip to sidebar Skip to footer

Magento remove white background color in the product images

Reading Time: 2 minutes

In this post is describing how to remove white background color in product images of Magento.This is happening magento is auto resizing images in the image blocks.If you using css styles, you can remove this white color.This is generating using php.
Check this example, you can understand this better.
Magento-remove-image-white-background-color.

How can I remove this white background color?

1-Open the app/code/core/Mage/Catalog/Model/Product/Image.php file.
2-Find this script there.You can see it in the line 44.
protected $_backgroundColor = array(255, 255, 255);
3-That color is given by rgb values.You can put your own color by rgb values.For a example if you want to put black color,
protected $_backgroundColor = array(0, 0, 0);
Here is a reference sites to find rgb values of colors.
http://cloford.com/resources/colours/500col.htm
http://www.yellowpipe.com/yis/tools/hex-to-rgb/color-converter.php
http://www.w3schools.com/html/html_colors.asp
4-Save the file and clear cache in the admin site using admin panel.Check your images in the front-end.

How can I resize magento product images?

I'm using Magento 1.3 version.
1-Go and open /app/design/frontend/default/default/template/catalog/product/view/media.phtml file.
2-Find the following script in line 73.There is a image tag.

<?php echo $this->htmlEscape($_image->getLabel()) ?>

3-Replace the following script.

<?php echo $this->htmlEscape($_image->getLabel()) ?>

Note there are width,height and keepFrame(false).
4-Also check the line 50 and 95 in,
/app/design/frontend/default/default/template/catalog/product/list.phtml
Line 33,
/app/design/frontend/default/default/template/catalog/product/view/defalut.phtml
5-Save all files, clear magento cache, check your images.If not worked check the correct template you have chosen.Also you can set like resize(375,208) as you wish.