ImageWriter writer = ImageWriterRegistry.getInstance().getWriterFor(MimeConstants.MIME_PNG);
if (writer == null) {
throw new ImageException("Cannot convert image to PNG. No suitable ImageWriter found.");
}
ByteArrayOutputStream baout = new ByteArrayOutputStream();
ImageWriterParams params = new ImageWriterParams();
params.setResolution((int)Math.round(src.getSize().getDpiHorizontal()));
writer.writeImage(rendered.getRenderedImage(), baout, params);
return new ImageRawStream(src.getInfo(), getTargetFlavor(),
new java.io.ByteArrayInputStream(baout.toByteArray()));
}