如何在ImageMagick中用透明的图像替换白色背景颜色? [英] How to replace white background color with transparent of an image in ImageMagick?

查看:803
本文介绍了如何在ImageMagick中用透明的图像替换白色背景颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的图像为 .jpg格式白色背景色。我想在 Imagemagick 中将白色背景颜色删除为透明。我尝试了很多方法,但仍然无法删除白色背景。有人可以帮我解决这个问题。

I have an image in .jpg format with white background color. I want to remove the white background color to transparent in Imagemagick. I tried many ways but still the white background can not be removed. Can some one help me to solve this.

推荐答案

首先,你需要转换图像格式来自 .jpg .png 格式,因为JPEG不支持透明度。然后使用此命令:

First, you need to convert the image format from .jpg to .png format, because JPEG does not support transparency. Then use this command:

convert image1.png -fuzz 20%-transparent white result.png

-fuzz 选项允许将纯白色的指定百分比偏差转换为透明。这很有用,例如,当您的图像包含噪点或细微渐变时。

The -fuzz option allows the specified percentage deviation from the pure white colour to be converted to transparent as well. This is useful, for example, when your image contains noise or subtle gradients.

这篇关于如何在ImageMagick中用透明的图像替换白色背景颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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