手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

在Linux中批量缩小图片的技巧

[日期:2007-08-18] 来源:Linux公社  作者:Linuxidc [字体:大 中 小]

Ubuntu论坛的原文资料复制如下:

mage MagicK 是一个强大的图象处理工具包。它提供了几个非常方便的命令行命令: display, animate,import, montage,mogrify,identify等,可以进行图象的显示,缩放,旋转,调色,加框,加注释等,还能制作GIF动画,图象索引,能自动生成图象.

1. 制作索引图和动画

!/bin/bash

montage -bordercolor red -borderwidth 3 -label "%f" -tile 5x3 *.JPG montage.jpg

mogrify -format gif *.JPG

display montage.jpg

animate *.JPG

2. 缩放 convert -sample 80x40 input.jpg output.jpg #注意:缩放后图像保持原来的长宽比例 convert -sample 25%x25% input.jpg output.jpg

3. 为当前目录的所有图像生成缩略图

for img in `ls *.jpg`

do

convert -sample 25%x25% $img thumb-$img

done

4. 获取文件信息 libtiff

tiffinfo filename.tiff

pnginfo filename.png

5. 可以使用 ImageMagick 的 identify

identify -verbose sample.png

identify -format "%wx%h" sample.png

6. 旋转图像

convert -rotate 90 input.jpg output.jpg

7. 更改文件类型

convert input.jpg output.png

8. 为图像增加注释文字

convert -font helvetica -fill white -pointsize 36 \

-draw 'text 10,50 "Floriade 2002, Canberra, Australia"' \

floriade.jpg comment.jpg

convert -font fonts/1900805.ttf -fill white -pointsize 36 \

-draw 'text 10,475 "stillhq.com"' \

floriade.jpg stillhq.jpg

9. 特殊效果

convert -charcoal 2 input.jpg output.jpg #炭笔

convert -colorize 255 input.jpg output.jpg #着色 可以指定三种颜色 red/green/blue

convert -implode 4 input.jpg output.jpg #内爆效果

convert -solarize 42 input.jpg output.jpg #曝光,模拟胶片曝光

convert -spread 5 input.jpg output.jpg #随机移动,参数是位移大小

10. 一次执行多个操作

convert -sample 25%x25% -spread 4 -charcoal 4 input.jpg output.jpg

linux
【内容导航】
第1页:在Linux中批量缩小图片的技巧 第2页:在Linux中批量缩小图片的技巧
相关资讯       Linux技巧 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款