Magento – Remove white background from thumbnail images in Magento 2.1.3

magento2

I want to remove white background from thumbnail images in my custom theme.

I have created custom theme for Magento 2.1.3
I made changes in order summary layout but when I try to load images on checkout page, it comes with white background at top and bottom.

I tried almost all solution available on stack overflow but no luck.
Any help would me appreciate.

enter image description here

Best Answer

In <vendor>/<theme>/etc/view.xml you should be able to adjust the settings of the image to remove the frame, like this:

<image id="category_page_grid" type="small_image">
    <width>610</width>
    <height>360</height>
    <frame>false</frame>
</image> 

However, there is an issue where setting <frame> to false returns true. See this Github issue, it was recently merged into the develop branch. If you're not using the develop branch for your site you'll still need to use the below fix until it's offically released:

After creating a plugin to convert the string value to an integer (which properly casts to a boolean), the image frame is not added.

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