“ImageMagick”的版本间的差异

来自wrc's Wiki
跳到导航 跳到搜索
第23行: 第23行:
 
convert input.png -fill none -draw 'color 1,1 floodfill' output.png
 
convert input.png -fill none -draw 'color 1,1 floodfill' output.png
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
=== 只允许几种颜色 ===
 +
 +
<ref>https://stackoverflow.com/a/55965617/10974106</ref>
 +
 +
<syntaxhighlight lang=bash>
 +
convert 'xc:#50c1c3' 'xc:#323232' 'xc:#f4891e' 'xc:#efefef' xc:'rgba(0,0,0,0)' +append palette.gif
 +
convert input.png +dither -remap palette.gif output.png
 +
</syntaxhighlight>
 +
 +
== 参考资料 ==
 +
 +
<references />
  
 
[[Category:Command Line]]
 
[[Category:Command Line]]

2021年5月11日 (二) 08:20的版本

ImageMagick 是一个图像处理工具。

例子

转换格式

convert input.png output.jpg

剪裁

convert -crop 800x600+10+10 input.png output.png

剪裁白色区域

convert input.png -trim output.png

将白色区域变为透明

convert input.png -transparent white output.png

将外侧的白色区域变为透明

convert input.png -fill none -draw 'color 1,1 floodfill' output.png

只允许几种颜色

[1]

convert 'xc:#50c1c3' 'xc:#323232' 'xc:#f4891e' 'xc:#efefef' xc:'rgba(0,0,0,0)' +append palette.gif
convert input.png +dither -remap palette.gif output.png

参考资料