使用ImageMagick和命令行提示设置透明背景 [英] Set transparent background using ImageMagick and commandline prompt

查看:921
本文介绍了使用ImageMagick和命令行提示设置透明背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设您有任何图像(PNG或JPG)。
这张图片有白色背景,我需要让这个背景透明。

Suppose you have any image (PNG or JPG). This image has a white background and I need to make this background transparent.

我试过这些例子:


  • convert original.png -background none transparent.png

  • convert original.png -background white -flatten -alpha off transparent.png

  • convert original.png -background none transparent.png
  • convert original.png -background white -flatten -alpha off transparent.png

但是没有理想的结果。

我该怎么做?

重要提示:使用转换命令行。

IMPORTANT: Using convert command-line.

推荐答案

我在Ubuntu 12.04上使用ImageMagick 6.6.9-7。< br>
对我有用的是:

I am using ImageMagick 6.6.9-7 on Ubuntu 12.04.
What worked for me was the following:

convert test.png -transparent white transparent.png

这会将test.png中的所有白色更改为透明。

That changed all the white in the test.png to transparent.

这篇关于使用ImageMagick和命令行提示设置透明背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆