本文介绍了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.
推荐答案
您想要的是下载 JAI图像I/O工具,它为JAI提供了ImageIO适配器.安装完之后,一切都会顺利进行.
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-保存灰度图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!