How do I resize an image so that the longest size is shorter or equal to an amount?

前端 未结 2 448
一整个雨季
一整个雨季 2021-01-31 04:37

I think that

mogrify -resize \"1000>\" *.jpg

resizes a bunch of jpegs so that the shorter side is 1000px if that side was longer than 1000px

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-31 05:10

    It should keep the aspect ratio / image proportions when using a geometry string with ">", so you can just do:

    mogrify -resize "1000x1000>" *.jpg
    

    So you're explicitly limiting the image to being, at most, 1000x1000 pixels, and keeping the current aspect ratio of the image.

提交回复
热议问题