產生固定大小的縮圖, 而不足比例的部份會以黑底呈現, 如下圖們
cmd :
convert [input.jpg] -resize [widthxheight] -gravity center [拿來當底的黑色底圖] +swap -composite [output.jpg]
ex : 640x360
convert /home/www/nas/home3/3b/b7/18430524/50026/xndgiY-4520928.jpg -resize 640x360 -gravity center /home/www/nas/home0/_vlog/images/black640.jpg +swap -composite /home/www/nas/home3/3b/b7/18430524/50026/xndgiY-4520928.jpg
ex : 120x90
convert /home/www/nas/home3/3b/b7/18430524/50026/m_xndgiY-4520928.jpg -resize 120x90 -gravity center /home/www/nas/home0/_vlog/images/black120.jpg +swap -composite /home/www/nas/home3/3b/b7/18430524/50026/m_xndgiY-4520928.jpg
ex : 128x96
convert /home/www/nas/home3/3b/b7/18430524/50026/s_xndgiY-4520928.jpg -resize 128x96 -gravity center /home/www/nas/home0/_vlog/images/black128.jpg +swap -composite /home/www/nas/home3/3b/b7/18430524/50026/s_xndgiY-4520928.jpg
cf :
http://ray.imiddle.net/2008/07/how-to-resize-the-image-in-imagemagick/
http://www.charry.org/docs/linux/ImageMagick/ImageMagick.html
http://www.shaoshing.com/2010/05/05/image-magick-solution-for-several-secnarios/
沒有留言:
張貼留言