1

Is it possible to change the magento2 product image background color white instead of another gray color.

can anyone know the answer . please help me to do this.

1
  • kindly find the screenshot. prnt.sc/lyuj14 instead of white background i want some another color
    – Priya
    Commented Jul 9, 2019 at 8:52

1 Answer 1

2

First you need to overide vendor/magento/module-catalog/Model/Product/Image.php in your local module.

In this file, there is background color declaration you need to change it

protected $_backgroundColor = [255, 255, 255];

After that run these commands:

php -dmemory_limit=1G bin/magento setup:upgrade
php -dmemory_limit=1G bin/magento setup:di:compile
php -dmemory_limit=1G bin/magento setup:static-content:deploy -f
php bin/magento cache:clean
php bin/magento cache:flush

I hope this will help

4
  • kindly find the screenshot. prnt.sc/lyuj14 instead of white background i want some another color
    – Priya
    Commented Jul 9, 2019 at 8:53
  • if i am doing above your answer means , i will get like this prnt.sc/ocijff
    – Priya
    Commented Jul 9, 2019 at 9:13
  • I share the example color code $_backgroundColor variable. Have you change the value of $_backgroundColor variable with your own color code ? like replace the value with your color code Commented Jul 9, 2019 at 9:15
  • Yes changed the color code
    – Priya
    Commented Jul 9, 2019 at 9:27

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.