Details
-
Bug
-
Status: Resolved
-
Resolution: Fixed
-
1.6
-
None
-
None
-
Operating System: other
Platform: Other
Description
With a specific svg image file the ImageTranscoder throws a BridgeException of
malformed URL. The transcoder works properly if the FileInputStream is sent
directly to the transcoder. In the client implementation this is not an
option since the SVG has been previously serialized to a byte array for
caching. (see attached svg).
// create a JPEG transcoder
JPEGTranscoder t = new JPEGTranscoder();
FileInputStream fis = new FileInputStream("C:
test7.svg");
int size = fis.available();
byte[] svgBuffer = new byte[size];
fis.read(svgBuffer);
fis.close();
// set the transcoding hints
t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,
new Float(.8));
// create the transcoder input
InputStream in = new ByteArrayInputStream(svgBuffer);
TranscoderInput input = new TranscoderInput(in);
// create the transcoder output
OutputStream ostream = new FileOutputStream("C:
test7.jpg");
TranscoderOutput output = new TranscoderOutput(ostream);
// save the image
t.transcode(input, output);
// flush and close the stream then exit
ostream.flush();
ostream.close();