Is there some way to mogrify images so that only the y axis (height) of the image is factored?
So what I mean is if I have say 20 images and they are all like:
1.jpg = 1024 x 768
2.jpg = 568 x 337
3.jpg = 290 x 560
It's fairly easy to make all of these be 500px wide and maintain the current aspect ratio by doing this:
mogrify -resize 500 *.jpg
or if I want to make them all 500 x 468 then I can do this
mogrify -resize 500x468 *.jpg
but I can't figure out how I can reset the height of all the images to (for example) 468 and retain the same aspect ratio, where all the images are already different sizes. I'd really like to know how to do it so does anybody know if this is possible?
I don't have my hopes up, and it would be quicker for sure to do all this in GIMP rather than waiting for a reply, but y'know, for the benefit of future generations and all that...
Mogrify height only
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
Mogrify height only
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Mogrify height only
Moved here by moderator
I use ImageMagick instead. Install the package "imagemagick" with the Software Manager, or run:
Open a terminal on the directory where you have your images, and run:
This scales all the images to a fixed height of 500 pixels, scaling the width dynamically to maintain the aspect ratio of the image. It creates files called new-0.jpg, new-1.jpg, new-2.jpg and so on. If you want some more control over the name, use a loop:
This adds the extension ".new.jpg" to the end of the original filename.
I use ImageMagick instead. Install the package "imagemagick" with the Software Manager, or run:
Code: Select all
sudo apt-get install imagemagick
Code: Select all
convert *.jpg -scale x500 new.jpg
Code: Select all
for name in $(ls *.jpg); do
convert $name -scale x500 $name.new.jpg
done