I feel silly for having to ask such a simple question, but I have spent the past hour having absolutely no luck whatsoever finding a solution to this. Everyone seems like they need to do the exact opposite of what I need to do.
My question is simply how do I tell mogrify and/or convert to not keep the aspect ratio when resizing an image? I need the image to be an exact power of 2 for both width and height and the images do not come in a 1:1 ratio which means one side has to stretch.
The closest thing I have to an answer is the -extent flag, but that just extends the canvas. I need the original image to fill the entire thing.
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.
To resize an image to specific dimensions, use the convert command with an input file, the -resize parameter, your preferred dimensions, and an output filename: convert original. png -resize 100x100 new. png.
When scaling your image, it's crucial to maintain the ratio of width to height, known as aspect ratio, so it doesn't end up stretched or warped. If you need a specific width and height, you may need a mixture of resizing and cropping to get the desired result.
After another half hour of searching I have stumbled upon the overly simple answer. The following will resize an image with the exact dimensions given:
mogrify input.png -resize 256x256! output.png
If you want to read more about it, I got the answer from this link:
https://superuser.com/questions/212752/how-to-stretch-an-image-in-one-dimension
use "!" in convert -resize
, for ex:
convert "from-img" -resize 800x480! "to-img"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With