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();
}
}
--
____________
http://reader.imagero.com the best java image reader.