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

前端 未结 2 421
一整个雨季
一整个雨季 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:05

    You could also use:

    find . -type f -exec convert {} -resize "1000>" {} \; 
    

    this might also be:

    find ./*.jpg -exec convert {} -resize "1000>" {} \; 
    
    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题