How to square an image and pad with transparency from the commandline (imagemagick)
问题 The section entitled Square Padding or Cropping describes a method to generate a square image--for a file whose dimensions are unknown--and pad the background with a color. How do I perform the same operation, but create a transparent background. 回答1: These modified methods from Anthony's examples both work for me: convert thumbnail.gif \ \( +clone -rotate 90 +clone -mosaic +level-colors grey -transparent grey \) \ +swap -gravity center -composite square_padded.gif convert thumbnail.gif