How to resize product image in magento 2?

For resize product image in Magento 2, You need to refer below code snippet for resizing product image at any place in the file.

You need to call helper file, Magento\Catalog\Helper\Image to resize product image.
Call Init() function and pass parameters,
First parameter as $product Object,
The second parameter as product id, You can be called any product id like thumbnail,small_image (Check the list of image id under the theme etc/view.xml file)
Third parameter as array its optional,

For Custom Image resize refer blog, Resize custom image in Magento 2

Return Product resizes url as output.

One Reply to “How to resize product image in magento 2?”

Leave a Reply

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