xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Mittermüller" <simon.mittermuel...@googlemail.com>
Subject Document saved as JPEG - getting IncompatibleClassChangeError
Date Thu, 22 Jan 2009 11:09:53 GMT
Hi,

Saving as SVG or PNG works fine.

But I am getting error when doing this:
I use this piece of code to save a document as a JPEG:

<code>
public void saveAsJPEG(File file) throws IOException,  
TranscoderException {

		JPEGTranscoder t = new JPEGTranscoder();
		t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, new Float(1.0));

		TranscoderInput input = new TranscoderInput(document);
		OutputStream ostream = new FileOutputStream(file);
		TranscoderOutput output = new TranscoderOutput(ostream);
		t.addTranscodingHint(JPEGTranscoder.KEY_WIDTH, new Float(100));
		t.addTranscodingHint(JPEGTranscoder.KEY_HEIGHT, new Float(100));
		t.transcode(input, output);
		ostream.flush();
		ostream.close();
	}
</code>

Exception in thread "AWT-EventQueue-0"  
java.lang.IncompatibleClassChangeError: Found interface  
com.sun.image.codec.jpeg.JPEGImageEncoder, but class was expected
	at  
org 
.apache 
.batik.ext.awt.image.codec.jpeg.JPEGImageWriter.writeImage(Unknown  
Source)
	at  
org.apache.batik.transcoder.image.JPEGTranscoder.writeImage(Unknown  
Source)
	at  
org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown  
Source)
	at  
org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown  
Source)
	at  
org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown  
Source)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java: 
2028)
	...


Has anybody had similar problems?
Where is "com.sun.image.codec.jpeg.JPEGImageEncoder" located? Inside  
the batik.jar? Or is it a problem of my com.sun.image.codec.jpeg  
package?


batik jar: batik-1.7.jar
I'am using JDK 1.5 on MacOsX 10.5.6.
Developing with Eclipse 3.4


Thx

Simon
Mime
View raw message