【发布时间】:2020-11-05 09:36:09
【问题描述】:
我想应用图像数据中的 alpha 蒙版。我有 不同格式的图像,即 tiffs、PSD PNG 和 jpeg。我是 将它们作为缓冲图像读取,并希望使用 Twelvemonkeys 库 获取图像中配置的 alpha 路径,并相应地应用透明度。但我找不到 相关功能。请帮忙。
ImageInputStream stream = ImageIO.createImageInputStream(new File(c:/img.psd);
BufferedImage image = Paths.readClipped(stream);
image.getcoclormodel().hasAlpha();
for(i < image.getwidth()) {
for(j < image.getHeight()) {
pixels = image.getRGB(i, j, width, height, null, 0, width);
Color col = new Color(pixels[pixelIndex]);
int p = col.getAlpha()
image.setRGB(i, j, width, height, p, 0, width)
}
}
【问题讨论】:
-
嗨,有趣,也许这可能会引起您的兴趣stackoverflow.com/questions/221830/…
-
我还想要在 photoshop 图像和其他 tiff 图像中配置的 alpha 通道,然后我想应用它们来获取新的缓冲图像
标签: java alpha javax.imageio twelvemonkeys