3

I have a bunch of images that are desktop wallpapers, but different sizes. For my examples, I will use the resolution 1920x1080. How do I scale the images so that:

  • For images smaller than my screen in width and height, the image is centered and then scaled up proportionally until the smaller of the two reaches 1920 or 1080
  • For images smaller than my screen in width or height, the image is centered and then
    • If the image is portrait, the width will be scaled up to 1920 and the height will be scaled proportionally
    • If the image is landscape, the height will be scaled up to 1080 and the width will be scaled proportionally
  • For images larger than my screen in width and height, the image is centered and then
    • If the image is portrait, the width will be scaled down to 1920 and the height will be scaled proportionally
    • If the image is landscape, the height will be scaled down to 1080 and the width will be scaled proportionally

I tried mogrify -resize 1920x *.png, mogrify resize x1080 *.png, and mogrify resize 1920x1080 *.png, but I get borders on at least 1 image with each of these commands.

stonewareslord
  • 343
  • 2
  • 13

1 Answers1

3

Ok. I've figured out what to do. There's a new feature in ImageMagick 6.3.8-3 called the Fill Area Flag. The command for what I'm looking for is:

mogrify -resize 1920x1080^ -gravity center *

This will center the image and resize it to the correct dimensions.

stonewareslord
  • 343
  • 2
  • 13