This is the standard code for resizing images:

If an image is rectangular, a white border appears around it. Sometimes that is undesirable. To change this behavior, use the following methods:

  • constrainOnly(true) (prevents resizing images that are smaller than the dimensions specified in resize(…))
  • keepAspectRatio(true) (preserves the aspect ratio of the image)
  • keepFrame(false) (removes the white border around the image)

The revised code could look like this:

Removing white borders around rectangular product images
Need help implementing this solution, or still looking for a fix to your Magento problem? Get in touch and I will be happy to help with your project.
Tags: