Convert a bitmap image to an uncompressed tif image in Java

被刻印的时光 ゝ 提交于 2019-12-05 13:05:50

You can use ImageWriteParam to disable compression:

TIFFImageWriterSpi spi = new TIFFImageWriterSpi();
ImageWriter writer = spi.createWriterInstance();
ImageWriteParam param = writer.getDefaultWriteParam();
param.setCompressionMode(ImageWriteParam.MODE_DISABLED);

ImageOutputStream ios = ImageIO.createImageOutputStream(new File("output.tif"));
writer.setOutput(ios);
writer.write(null, new IIOImage(bmp, null, null), param);
Mukesh Singh Rathaur

Some time before i was facing the problems with tiff images reading and conversion with jai. I found that it need to install support for working with tiff images in jai, then it works fine for me u can also get it form here: https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=jaiio-1.0_01-oth-JPR@CDS-CDS_Developer

and install over a jvm then it will also work for you. you can also have a look here Java / JAI - save an image gray-scaled

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!