Magento – Images have white space

imagemagento-2.1

I'm having some troubles with product images in Magento.

I'm using Porto theme, in homepage I have a 4-featured-items grid (2×2). I want images to be 610x360px but I'm not able to do this. Instead I have images with white space.

Strange is, if I open the inspector and find the img url, open it in browser and I see that images have white border (added by Magento?). Can't figure it out.

I'm new in Magento, it is pretty urgent.

You can see the issue here: mobiroloshop.com (got same problem with all images in website)

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 open issue where setting <frame> to false returns true. See this Github issue.

There is also a fix in the Github comments:

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];
}