I have vertical (i.e. height > width) and horizontal (i.e. width > height) images. I want to resize them to either 900-pixels-height vertical ones or 900-pixels-width ones based on their original ratio.
I am using Ubuntu 20.04 in Gnome environment. I think that mogrify
of imagemagick will solve this problem, a pseudo code would be like...
for i in *.jpg; do
_w = identify -format %w
_h = identify -format %h
if [_w >= _h]; then
mogrify -resize 900x675 i
else
mogrify -resize 675x900 i
fi
done
but couldn't find the way.