Hello to all my dear friends!
One day I was looking a way to resize image. I created a Slack application. It was asking to upload application icon in square dimension between 512x512px to 2000x2000px.
But the image I had was not of square dimension. Therefore I decided to resize the existing image. I found a quick way to do so using magick utility (earlier the command was convert) in Linux.
magick allows to resize image, change image format and other operations like blur, crop, flip, join, etc.
Here is how to resize to exact width and height.
magick slack-app.png -resize '768x768!' slack-app-icon.png
File dimension of original image
file slack-app.png
slack-app.png: PNG image data, 769 x 768, 8-bit/color RGBA, non-interlaced
File dimension of resize image
file slack-app-icon.png
slack-app-icon.png: PNG image data, 768 x 768, 8-bit/color RGBA, non-interlaced
The correct way to resize to exact “width x height” is to use dimension as “768×768!”. Note the exclamation. Without using it, it resizes the image to the dimension 768×767.