Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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. What can I use to resize the jpegs so that the longer side is less than 1000px?

Thanks!

like image 506
bsamek Avatar asked Apr 17 '11 16:04

bsamek


People also ask

How do you make a long picture shorter?

Open the picture in the image editing program of your choice, and then look for something like Resize, Image Size, or Resample, usually contained in the menu bar under Edit. Select the number of pixels you like for the reduced dimensions and save the image with a new file name using the Save As function.

How do I resize an image without losing the ratio?

Press-and-hold the Shift key, grab a corner point, and drag inward to resize the selection area. Because you're holding the Shift key as you scale, the aspect ratio (the same ratio as your original photo) remains exactly the same.

How do you resize an image to 2048px in its longest edge?

Go to the options under Imaging Sizing. Choose “Resize to Fit.” Then click the drop down box and choose “Long Edge.” Type in 2048* and make sure pixels is selected.


1 Answers

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.

like image 99
coreyward Avatar answered Nov 03 '22 17:11

coreyward