Writing tiff image files

I'm trying to save an image as an uncompressed tiff. I have seen several ways to do this but I'm have a hard time figuring out the differences between them. I just want to save my BufferedImage as a tiff without losing any information. If someone could tell me the best way to do this that would be great. These are the three methods I have been using. Thanks.

1)

Iterator writers = ImageIO.getImageWritersByFormatName("tiff");

ImageWriter writer = (ImageWriter)writers.next();

ImageOutputStream out = ImageIO.createImageOutputStream(file);

writer.setOutput(out);

writer.write(image);

2)

FileOutputStream out =new FileOutputStream(file);

TIFFEncodeParam param =new TIFFEncodeParam();

param.setCompression(TIFFEncodeParam.COMPRESSION_NONE);

ImageEncoder encoder = ImageCodec.createImageEncoder("TIFF", out, param);

encoder.encode(image);

3)

ImageIO.write(image,"tiff", file);

[1112 byte] By [CanesVa] at [2007-11-27 9:19:46]
# 1

There are several ways to write an image, all of which do the same thing. I guess the biggest difference is the level of control in the writing process you need. Whichever one does what you want and makes sense to you, I would go with. I could even give you another way to do this (which is more a mixture of 1 and 2). Anyways, as long as the image it writes is uncompressed per your specs, it doesn't really matter. Right?

Or is that your point... some of these methods don't write uncompressed TIFF's?

CowKing

IamCowKinga at 2007-7-12 22:12:20 > top of Java-index,Security,Cryptography...