5

Magento 2 - How can I remove the white borders from images in product list page?

how can i remove white frame around image in product list page

2 Answers 2

4

You have to add false to view.xml in YOUR_THEME/etc/view.xml to the "category_page_list" image ID.

Example:

<?xml version="1.0"?>
<view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/view.xsd">
    <media>
        <images module="Magento_Catalog">
            <image id="category_page_list" type="small_image">
                <width>240</width>
                <height>300</height>
                <transparency>false</transparency>
            </image>
        </images>
    </media>
</view>
6
  • I try but this is not working still get border frame top and bottom side of the product image Dec 6, 2016 at 8:42
  • the sollution I posted is to remove from the resize function but if your image is smaller than the resize width and height it will have that border you can check this link to see all the options for resize and image parameters devdocs.magento.com/guides/v2.0/frontend-dev-guide/themes/…
    – Vlad Patru
    Dec 6, 2016 at 8:51
  • i have set height and width issue has been resolve<image id="category_page_grid" type="small_image"> <width>250</width> <height>250</height> </image>thanks Dec 6, 2016 at 9:29
  • Good to hear that, you coul also mark the question as resolved so others know and use the fix
    – Vlad Patru
    Dec 6, 2016 at 9:56
  • 2
    @jafarpinjar you need to remove your images cache folder from pub/media/catalog/product/cache I just checked and that should solve
    – Vlad Patru
    Jan 9, 2019 at 17:14
2

in view.xml set "width" and "height" as you wish and then "aspect_ratio" and "frame" to "false"

enter image description here

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.