星期五, 3月 27, 2015

簡單 ImageMagick convert 指令

縮放圖片以填滿指定大小:
Resize the image to fill the requested size. Some portion of the image may be clipped:
convert input.png -resize 100x100^ -gravity center -extent 100x100 output.png
縮放圖片在指定大小以內:
Resize the image to fit the requested size and maintaining the aspect ratio. Some portion of the output image may be blank:
convert input.png -resize 100x100 -gravity center -extent 100x100 output.png
縮放圖片到指定大小,不保持長寬比例:
Resize the image to the requested size ignoring the aspect ratio:
convert input.png -resize 100x100\! output.png
取GIF動畫的第一格:
Obtain only the first frame in an animated GIF file:
convert input.gif\[0\] output.png