I have seen the use of the >
operator for the geometry of the -rescale
option for ImageMagick, which basically ensures that the longer axis is scaled down to the desired length. What I am looking for is similar, but for the shorter axis. Also, >
apparently prevents any upscaling, which is not what I want.
Let me explain with an example:
- The desired size of an image is given as X, let’s say 512 pixels.
- An image with resolution 1920×1080 would be scaled down to (roughly) 910×512, because
y
is the shorter axis, therefore it gets rescaled to 512, andx
scales down accordingly, preserving aspect ratio - An image with resolution 1000×3000 would be scaled down to 512×1536, because
x
is the shorter axis, therefore it gets rescaled to 512, andy
scales down accordingly, preserving aspect ratio - An image with resolution 600×300 would be scaled up to 1024×512, because
y
is the shorter axis, therefore it gets rescaled to 512, andx
scales up accordingly, preserving aspect ratio
Is there an existing command or syntax in ImageMagick that I can use to accomplish this?