Forums Register Login

JAI question

+Pie Number of slices to send: Send

Hi all,

In one of our application we are using following JAI code to convert TIFF images to PNG images.

PNGEncodeParam param = new PNGEncodeParam.Palette();
TIFFDecodeParam inparam = new TIFFDecodeParam();
inparam.setDecodePaletteAsShorts(true);

int iTotalPages = 0;
try {

InputStream instream = new ByteArrayInputStream(arrImage);
ImageDecoder dec = ImageCodec.createImageDecoder("tiff", instream, inparam);
iTotalPages = dec.getNumPages();

for (int iPageNo = 0; iPageNo < iTotalPages; iPageNo++) {
RenderedImage image = dec.decodeAsRenderedImage(iPageNo);
OutputStream os = new FileOutputStream(localDirectory + "/" + Image + "_" + (iPageNo + 1) + ".png");

ImageEncoder encoder = ImageCodec.createImageEncoder("PNG", os, param);
encoder.encode(image);
}
}
catch (Exception objException) { }

Note: arrImage is a byte array passed after reading the TIFF file.

This program finished till the last line of code but hangs almost everytime. after looking at the Thead dump I saw one thread that is still waiting for the condition and it looks like this

at com sun media jai codecTempFileCleanupThread.run(FileCacheSeekableStream.java:321)

it looks like the internal Thread spawned by JAI apis to clean temporary files. the JAI version we are using is 1.1.2_01. Java version is J2RE 1.4.2 IBM AIX 5L for PowerPC (64 bit JVM) build caix64142-20060421 (SR5).

If anybody has any insight in the issue, please help.

Thanks
Ashish
+Pie Number of slices to send: Send
Ashish,
Please Use Code Tags in the future. Thanks.
+Pie Number of slices to send: Send
will do. thanks.

if you think brussel sprouts are yummy, you should try any other food. And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 3014 times.
Similar Threads
Pagination
changing colors
problems while converting
combining tif files with java
Splitting Tiff file with JAI taking more time
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 14:49:07.