Resize image with mogrify without keeping aspect ratio

ozdrgnaDiies picture ozdrgnaDiies · Dec 7, 2013 · Viewed 10.7k times · Source

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.

Answer

ozdrgnaDiies picture ozdrgnaDiies · Dec 7, 2013

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