May 16

linux下批量缩小图片 不指定

felix021 @ 2009-5-16 01:02 [IT » 软件] 评论(0) , 引用(0) , 阅读(4904) | Via 本站原创 | |
(参考网上的资料)用到了 ImageMagick 工具包。
@ Ubuntu
sudo apt-get install imagemagick

引用
$ convert -resize 50%x50% 1.jpg 1_small.jpg
就可以把 1.jpg 的尺寸缩小到越来的1/4
引用
$ convert -sample 400x300 1.jpg 1_small.jpg
就可以把 1.jpg 的尺寸缩小到400x300
注意,两个比率/数字之间的是字母x,不是乘号。

然后来个批量转换的东东(网上的教程是for,虽然我比较喜欢find)
引用
for img in `ls *.jpg`; do convert -resize 50%x50% $img small_$img; done

如果要递归地转换当前目录以及子目录的图像就用find吧:
引用
find -name "*.jpg" -exec convert -resize 50%x50% {} {}.small.jpg




欢迎扫码关注:




转载请注明出自 ,如是转载文则注明原出处,谢谢:)
RSS订阅地址: https://www.felix021.com/blog/feed.php
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   *非必须
网址   电邮   [注册]