// create a servlet
ImageTranscoder bufferedImgTranscoder =
new BufferedImageTranscoder();
TranscoderInput transcoderInput =
new TranscoderInput(imageInputStreamAdaptor);
// create the servlet output
BufferedImageTranscoderOutput output =
new BufferedImageTranscoderOutput();
// perform the transcoding
try {
bufferedImgTranscoder.transcode(transcoderInput, output);
} catch (TranscoderException e) {
String imagePath = transcoderInput.getURI();
logger.error("svg-transcoding-error", imagePath, e);
throw new IOException(e.getLocalizedMessage());
}
return output.getBufferedImage();
}