Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Write Multiple tiff images in Single File

843806Feb 5 2008
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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 4 2008
Added on Feb 5 2008
0 comments
191 views