• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JAI question

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ashish,
Please Use Code Tags in the future. Thanks.
 
Ashish Gauswami
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
will do. thanks.

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic