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 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
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.
$ $ convert image.jpg -resize 400x400! output.jpg
Here is another article you might like 😊 "Simple PHP Templating Engine"