Magento Tutorials

How to Configure Image Sizes in Magento

Product Image is the first impression and the closest thing customers can picture the products in their mind. Therefore, it is really important to not only use high-quality images to describe the product, but also to keep your site in good performance as well.

Automatic image size optimization

The Media Gallery Image Optimization setting in Magento can help resize unnecessarily large images in your Media Library. As a result, the file sizes of your images are decreased and thus, bring a performance boost to your storefront. 

This feature is enabled by default, but you can choose to disable or to change the maximum allowed width and height of the images by going into: System > Configuration.
Under the left panel, choose Advanced > System.

Advanced System Magento

And expand the Media Gallery Image Optimization section.

Media Gallery Image Optimization

Here you can choose whether to enable or disable Media Gallery Image Optimization, and choose the maximum allowed width & height for the images in your Media Gallery. Optimized images are automatically generated in your Media Gallery and replace your original images.

Note that changing the maximum width and maximum height will update your existing optimized images.

Automatic product image size optimization

In Magento, you can also optimize the sizes of your product images by enabling Frontend Resize. Note that this setting is different from the above Media Gallery Image Optimization setting which is used to optimize all of the images in your Media Gallery.

In the same Advanced > System setting (Stores > Configuration > Advanced > System), expand the Image Upload Configuration setting.

Image upload configuration

Here you have the option to choose:

  • Quality: the quality of the resized images (0 – 100%, with 0% being the worst quality). The recommended quality is between 80 – 90% in order to keep product image quality optimal.
  • Enable Frontend Resize: choose to enable or disable product image resizing on your frontend
  • Maximum Width & Maximum Height: the maximum width and maximum height for your resized product images

Change default product image size 

In case you want to, you can also change your default product image sizes (which is 800×800 px). All you’d need to do is to access the view.xml file located at:

<theme_dir>/etc/view.xml

For example, here is the path to the view.xml for the default Lumia theme:

app/design/frontend/Magento/luma/etc/view.xml
Content of the default view.xml file
Content of the default view.xml file

In this file you can change the <width> and <height> of any <image id> to your liking, and the results will be reflected accordingly after running the following command:

php /bin/magento catalog:images:resize -a

See also: How to Resize Images in Magento 1 & 2

Dom

A knowledge craver who always strive to be wiser everyday.

Subscribe
Notify of
guest

4 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Zeni
Zeni
6 years ago

Product Image is not in my settings when I enter the catalogue configurations. I can’t upload pictures because the following sentence is showing up “Maximum width and height dimension for upload image is .”

Is it a bug??

marissa s jones
4 years ago

This did not work for me at all

Delilah Walker
Delilah Walker
1 month ago

I really like how informative and clear the information is. I don’t know many great blogs where information is presented in an interesting and meaningful way. Depositphotos blog is not just a blog, but a real key to an incredible world of meaningful and interesting information. Each post is a new round of knowledge that expands my understanding of the world. For me, this is not just a blog, but a source of inspiration and discovery!