Resize product images in Magento2

To resize product images in Magento2,  you just have to add a etc/view.xml into your own theme (f.e. app/design/frontend/Sheldon/Happytheme/etc/view.xml) ans add something like that:

<?xml version="1.0"?>
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
<view xmlns:xsi=""
        <images module="Magento_Catalog">
            <image id="product_image" type="image">
            <image id="product_small_image" type="small_image">
            <image id="product_thumbnail_image" type="thumbnail">
            <image id="swatch_image" type="swatch_image">

As you can see, you can adapt the image dimensions for each image type available. That works also for self installed image types. The values for width and height are pixel values. That’s all about resize product images in Magento2. We don’t need a single line of PHP in version 2! That’s pretty cool, isn’t it? 😉

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.