JAI + JPEG2000

  • Thread starter Sebastian Ryszard Kruk
  • Start date
S

Sebastian Ryszard Kruk

Hi,

did any one manage to read/write JPEG2000 images with JAI Tools? I got
an error like this while writing

Exception in thread "main" java.lang.NoClassDefFoundError:
com/sun/medialib/codec/jp2k/Encoder
at
com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageWriterCodecLib.write(J2KImageWriterCodecLib.java:143)
at javax.imageio.ImageWriter.write(ImageWriter.java:591)
at javax.imageio.ImageIO.write(ImageIO.java:1434)
at javax.imageio.ImageIO.write(ImageIO.java:1472)
at Convert.main(Convert.java:31)

it seams to me that jp2k library is not in the classes that JAI is
trying to find - but rather in /jj2000 package.

Do you do something wrong? How to solve it?

I attach my code.

Thanks in advance

skruk

// ==========================================

public static void main( String[] argv ) {
try {
String inputFilename = argv[0];
BufferedImage image = ImageIO.read( new File( inputFilename ) );
//...
String formatName = argv[1];// desired format
String outputFilename = inputFilename.substring( 0,
inputFilename.lastIndexOf( "." ) + 1 ) + formatName;

File outputFile = new File( outputFilename );
boolean writerExists = ImageIO.write( image, formatName, outputFile );

System.out.println( "STATUS [" + inputFilename + "] -> [" +
outputFilename + "]: " + writerExists );

}
catch( Exception ex ) {
ex.printStackTrace();
}
}
 

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,792
Messages
2,569,639
Members
45,351
Latest member
RoxiePulli

Latest Threads

Top