i want to remove white background for product image but it's not working all... i have apply How to remove white background from product images in Magento 2.2.6? this solution but still same..

Please check SS for slider https://nimb.ws/RpcNFm

<image id="category_page_list" type="small_image">

Thanks in advance for help !!

1 Answer 1


It's Maybe Magento Core issue. Not sure, It's solved or not. But, If you didn't get result using XML change then, you can create plugin for that :


<?xml version="1.0"?>
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
  <type name="Magento\Catalog\Model\Product\Image">
    <plugin name="remove_white_bg_plugin" type="RH\Helloworld\Plugin\Product\Image" sortOrder="1"/>

Create Plugin File :



namespace RH\Helloworld\Plugin\Product;

class Image {
    public function beforeSetKeepFrame($image, $keep)
        if (is_string($keep)) {
            $keep = (strtolower($keep) === 'true') ? 1 : 0;
        return [$keep];

Clean cache and check it.

  • For testing purpose i have added above code to Magento\Catalog\Model\Product\Image file directly but it's not working...... Original image has white background and it's jpg image any another way for same... thanks @rohan May 1, 2020 at 4:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.