JAI - How to convert PNG to TIFF

A

Armin Gajda

Hi,

JAI can be used to convert PNG images files to TIFF:


String source = "c:/tmp/1.png";
FileOutputStream out = new FileOutputStream ("c:/tmp/2.tiff");
RenderedOp src = JAI.create("fileload", source);
TIFFImageEncoder encoder = new TIFFImageEncoder (out, null);
encoder.encode (src);

1. I don't want to run it file based, so I was wondering how to pass the
source file as a stream.

2. A 15K PNG file is blown up to 2.5 MB TIFF. How can I use a compression?

thank you

Armin
 
A

Armin Gajda

Armin said:
Hi,

JAI can be used to convert PNG images files to TIFF:


String source = "c:/tmp/1.png";
FileOutputStream out = new FileOutputStream ("c:/tmp/2.tiff");
RenderedOp src = JAI.create("fileload", source);
TIFFImageEncoder encoder = new TIFFImageEncoder (out, null);
encoder.encode (src);

1. I don't want to run it file based, so I was wondering how to pass the
source file as a stream.

Just found out the magic word is 'stream' and works together with a
ByteArraySeekableStream.

But what about the compression?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top