更改 BufferedImage 的 alpha 值? [英] Change the alpha value of a BufferedImage?

查看:30
本文介绍了更改 BufferedImage 的 alpha 值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Java 中更改 BufferedImage 的全局 alpha 值?(即,使图像中 alpha 值为 100 的每个像素的 alpha 值为 80)

How do I change the global alpha value of a BufferedImage in Java? (I.E. make every pixel in the image that has a alpha value of 100 have a alpha value of 80)

推荐答案

我不相信有一个简单的命令可以做到这一点.几个选项:

I don't believe there's a single simple command to do this. A few options:

  • copy into another image with an AlphaComposite specified (downside: not converted in place)
  • directly manipulate the raster (downside: can lead to unmanaged images)
  • use a filter or BufferedImageOp

第一个是最容易实现的,IMO.

The first is the simplest to implement, IMO.

这篇关于更改 BufferedImage 的 alpha 值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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