Hello Friends,
I am using this code to write multiple tiff images in to one single tiff image, Which gives java.lang.illegalStateException ; no writers found.
ImageWriter writer = null;
Iterator iter = ImageIO.getImageWritersByFormatName("tiff");
if (! iter.hasNext())
{
throw new IllegalStateException("no writers found");
}
if (iter.hasNext()) {
writer = (ImageWriter)iter.next();
}
InputStream ins0 = new FileInputStream("c:/Andy/JAI/image1.tif";);
BufferedImage img0 = ImageIO.read(ins0);
InputStream ins1 = new FileInputStream("c:/Andy/JAI/image2.tif";);
BufferedImage img1 = ImageIO.read(ins1);
ImageOutputStream ios = ImageIO.createImageOutputStream(new File("c:/Andy/JAI/image12.tif";));
writer.setOutput(ios);
(ImageWriteParam.MODE_EXPLICIT);
// iwp.setCompressionQuality(compressionQuality);
writer.write(new IIOImage(img0, null, null));
writer.writeInsert(1, new IIOImage(img1, null, null), null);
ios.flush();
writer.dispose();
ios.close();
Please help me out its really urgent.
Thanx in Advance.