Resize image to exact size by maintaining aspect ratio nodejs
问题 I want to resize image to an exact size by maintaining aspect ratio and filling the empty space with transparency using nodejs. I am able to do it using canvas. But due to some server os issues I can not use canvas. I tried with imageMagick and gm. But couldn't find any option like these. Please show me a way to do this. Thanks in advance. 回答1: In ImageMagick, you can resize and fill to the exact size by convert image -resize WxH -background none -gravity center -extent WxH output Input: Here