How to resize an image but keep it's orientation and aspect ratio ? (gm)

214 Views Asked by At

I would like to resize an image to a maximum height of 400px, while keeping its orientation and aspect ratio.

This resizes the image, but changes its orientation (if it is portrait it changes it to landscape).

 gm(file.stream)
    .resize('400')
1

There are 1 best solutions below

0
On

Ah, found it.

 gm(file.stream)
    .resize('400','400')
    .autoOrient()