如何在java中将图像转换为透明图像 [英] How to convert an image into a transparent image in java

查看:86
本文介绍了如何在java中将图像转换为透明图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将图像的白色背景转换为透明背景?谁能告诉我怎么做?

How to convert a white background of an image into a transparent background? Can anyone tel me how to do this?

推荐答案

谷歌的第一个结果就是:

The first result from Google is this:

使颜色透明
http:// www .rgagnon.com / javadetails / java-0265.html

它使图像的蓝色部分透明,但我相信你可以适应使用白色intstead

It makes the Blue part of an image transparent, but I'm sure you can adapt that to use White intstead

(提示:将 Color.WHITE 传递给 makeColorTransparent 函数,而不是 Color.BLUE

(hint: Pass Color.WHITE to the makeColorTransparent function, instead of Color.BLUE)

在这里找到一个更完整和现代的答案: 如何使颜色透明在BufferedImage中保存为PNG

Found a more complete and modern answer here: How to make a color transparent in a BufferedImage and save as PNG

这篇关于如何在java中将图像转换为透明图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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