Search code examples
assetsakeneo

Akeneo resizing asset variation keeps proportions


I use Akeneo 2.1.9 EE version.

I wrote a configuration file to generate asset variation for a specific channel, which sets width and length to 750px

asset_channel_configurations:
     ecommerce:
         configuration:
             resize:
                 width: 750
                 height: 750

But then when I generate variations for a rectangular image, it doesn't change to a square and keeps proportions with the width or height at 750px.

Why do I get this behavior ? Isn't resize supposed to not keep proportions ?

Thanks


Solution

  • Akeneo is using ImageMagick for asset variations. By default, the resize command does keep proportions. It is possible to force Imagemagick to ignore it. In this case you will have a square image, regardless of the original ratio. That means it would be distorted to fit the square aspect ratio, if the input was not square.

    However, this is not possible in Akeneo. So you have two solutions: - you can either add a new transformation that will resize without respecting the image ratio - or you can override the existing Akeneo resize implementation (it is in the class Akeneo\Component\FileTransformer\Transformation\Image\Resize, in Enterprise Edition only) so it always ignores the ratio.