While Magento developer works on custom modules images, they may face problems with images being displayed in different sizes on the frontend. There are two ways only to resolve this problem. First is using CSS and second is resize the actual image file but CSS option would not be advisable.
What are the benefits of resizing the actual image file instead of using CSS to resize them in HTML?
If there is a difference between the source and target image sizes, the default resizes utility provided by CSS can’t be used.
How to resize the actual image in Magento 2?
Step 1: You need to create helper class file Image.php at Vender\Module\Helper\Image.php and the past below code.
Step 2: Using below code you can call above imageResize() method from any class, block or template.
If you want to learn more using with programming then read this How to Change the Default Product Image Size in Magento 2
