1

I have inserted the image into the product and check then product coming with the white background.How to remove this white background and display image small ?

enter image description here

6
  • Can't you achieve this with css? like extend the product page style in your custom theme?
    – Korbin
    Commented Jul 30, 2019 at 6:23
  • 1
    This is a image not a content Commented Jul 30, 2019 at 6:30
  • tried this Answer ?
    – Piyush
    Commented Jul 30, 2019 at 6:31
  • Hello @Piyush, This is for a category page. Not for a product detail page Commented Jul 30, 2019 at 6:34
  • 1
    Not working bro, I have checked Commented Jul 30, 2019 at 6:58

1 Answer 1

1

One of the possible solution, In etc/view.xml of your current theme, you can update product image size

Make sure you resize with the expect ratio.

Use additional tag <frame> to prevent white borders on image. Use this code as example:

<image id="product_page_main_image" type="small_image">
  <width>460</width>
  <height>460</height>
  <aspect_ratio>true</aspect_ratio>
  <frame>false</frame>
</image>

After changes run:

php bin/magento catalog:images:resize
php -dmemory_limit=1G bin/magento setup:static-content:deploy -f
php bin/magento cache:clean
php bin/magento cache:flush
4
  • 1
    Hello, After changes it is required to run php bin/magento catalog:images:resize command ? Commented Jul 30, 2019 at 6:42
  • Yes, also run these commands as well php -dmemory_limit=1G bin/magento setup:static-content:deploy -f php bin/magento cache:clean php bin/magento cache:flush Commented Jul 30, 2019 at 6:47
  • @MuhammadHasham, I have edited please remove comments dear. and your solution seems worked Commented Jul 30, 2019 at 7:27
  • 1
    It is worked !!! Commented Jul 30, 2019 at 7:29

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.