Last updated 2022-09-04 07:58:50

Resize Image To Exact Dimensions | Imagemagic

ImageMagick [↗] provides a host of tools like the Convert command for modifying images. The Convert command can be used to resize images. You can resize your images in two ways.

Approximate resizing

Approximate resizing will resize your image to a dimension closer to the one you specified without distorting the image.Convert employs this method by default.

$ $ convert image.jpg -resize 400x400 output.jpg

Exact resizing

When you use exact resizing, you can resize your image to the exact dimensions you specify. To achieve this you will have to place an exclamation mark at the end of your dimension. Eg: 400x400!

$ $ convert image.jpg -resize 400x400! output.jpg

Here is another article you might like 😊 "Simple PHP Templating Engine"