Java/JAI-保存灰度图像 [英] Java / JAI - save an image gray-scaled

查看:99
本文介绍了Java/JAI-保存灰度图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试保存tiff而不是彩色的灰度.我该怎么办? (必须使用JAI,因为它是tiff!)

I try to save the tiff instead of coloure gray-scaled. How could I do this? (JAI must be used, because it is a tiff!)

非常感谢&最好的问候.

Thanks a lot in advance & Best Regards.

推荐答案

您想要的是下载

What you want is to download the JAI Image I/O Tools, which provides ImageIO adapters for JAI. Once you've installed that, it's smooth sailing.

final BufferedImage in = ImageIO.read(new File("frabozzle.tif"));
final BufferedImage out = new BufferedImage(
    in.getWidth(), in.getHeight(),
    BufferedImage.TYPE_BYTE_GRAY);
out.getGraphics().drawImage(in, 0, 0, null);
ImageIO.write(out, "TIFF", new File("graybozzle.tif"));

这篇关于Java/JAI-保存灰度图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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