views:

3289

answers:

7

I am looking at java APIs to convert JPEG file streams to TIFF files. I looked at the JAI but did not find something similar to what i am looking at.

Can someone point me to a good API which does this ?

+1  A: 

ImageMagick has a Java api available

Jherico
+1  A: 

The javax.imageio package has built-in writers for most of the popular image types, including jpg and tiff. Here's Sun's page on imageio.

http://java.sun.com/javase/6/docs/technotes/guides/imageio/index.html

Hardwareguy
+1  A: 

There's an example here

http://log.robmeek.com/2005/08/write-tiff-in-java.html

and another here

http://stackoverflow.com/questions/281512/tiff-compression-using-java-imageio

objects
I tried this example and successfully converted the JPEG2TIFF. I am able to open it with IrfanView but not with Microsoft picture Viewer. Also the Microsoft Image Document says that this TIFF image is corrupted. Do you have any idea why this happens ?
EclipseGuru
no idea sorry. have you tried different compression options to see if that makes a difference
objects
+1  A: 

JIMI is quite easy to use. http://java.sun.com/products/jimi/

Unfortunately Sun transmogriffed it into Java2D (afair) and THAT is not quite that easy to use.

For a quick solution, use JIMI.

Thorbjørn Ravn Andersen
A: 

@Hardwareguy javax.imageio does not support TIF.

tpierzina
A: 

JAI (Java Advanced Imaging) is the best solution. It has a decoder and encoder for TIFF files.

BoDiE2003
A: 

JAVA JAI does support encoding/decoding TIFF. You need to get the image codecs (<--link) and call them like ImageDecoder decoder = ImageCodec.createImageDecoder("tiff", seekableStream, null);

Jake