z500zag z500zag wrote:
FYI,
The following works fine:
java -jar batik-rasterizer.jar -m image/jpeg -a 0,0,250,250 -d . anne.svg
When I use the sample programs on the Batik website (SaveAsJPEG or
SaveAsJPEGTiles), I get an exception when using the exact same SVG
document. The API program complains about the Batik Logo for some
reason.
The anne.svg (actually most of our samples) contains a
relative reference to the Batik Logo which provides a box and
the Batik 'squiggle' in the lower right hand corner. When you
copied anne.svg to to /tmp/flow/custom you didn't copy
the Batik Logo so the relative reference failed.
----------------------- output ----------------------------------
c:\temp\flow\custom>javac -classpath
c:\temp\flow\custom\batik-1.5.1\batik.jar;c:\temp\flow\custom\batik-1.5.1\batik-
;c:\temp\flow\custom\batik-1.5.1\batik-svgpp.jar;c:\temp\flow\custom\batik-1.5.1\batik-ttf2svg.jar;c:\temp\flow\custom
ib\batik-transcoder.jar SaveAsJPEG.java
c:\temp\flow\custom>xx SaveAsJPEGTiles
c:\temp\flow\custom>java -classpath
.;c:\temp\flow\custom\batik-1.5.1\batik.jar;c:\temp\flow\custom\batik-1.5.1\batik
r;c:\temp\flow\custom\batik-1.5.1\batik-svgpp.jar;c:\temp\flow\custom\batik-1.5.1\batik-ttf2svg.jar;c:\temp\flow\custo
lib\batik-transcoder.jar SaveAsJPEGTiles
XXX: anne.svg
XXX: file:/c:/temp/flow/custom/anne.svg
Exception in thread "main"
org.apache.batik.transcoder.TranscoderException: null
Enclosed Exception:
file:/c:/temp/flow/custom/anne.svg:-1
An I/O error occured while processing the URI:
"batikLogo.svg#Batik_Tag_Box"
specified on the element <use>
at
org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(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 SaveAsJPEGTiles.tile(SaveAsJPEGTiles.java:30)
at SaveAsJPEGTiles.main(SaveAsJPEGTiles.java:42)
c:\temp\flow\custom>
----------------------- code ----------------------------------
import java.io.*;
import org.apache.batik.transcoder.image.JPEGTranscoder;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
public class SaveAsJPEG {
public static void main(String [] args) throws Exception {
// create a JPEG transcoder
JPEGTranscoder t = new JPEGTranscoder();
// set the transcoding hints
t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,
new Float(0.8));
// create the transcoder input
String svgURI = new File(args[0]).toURL().toString();
TranscoderInput input = new TranscoderInput(svgURI);
// create the transcoder output
OutputStream ostream = new FileOutputStream("out.jpg");
TranscoderOutput output = new TranscoderOutput(ostream);
// save the image
t.transcode(input, output);
// flush and close the stream then exit
ostream.flush();
ostream.close();
System.exit(0);
}
}
_________________________________________________________________
Get reliable access on MSN 9 Dial-up. 3 months for the price of 1!
(Limited-time offer)
http://click.atdmt.com/AVE/go/onm00200361ave/direct/01/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]