@Override
public void serialize( RenderingInfo rinfo, BufferedImage img, OutputStream out )
throws IOException {
if ( rinfo != null && rinfo.getEnvelope() != null ) {
long ts, te;
RasterGeoReference geoRef = create( OriginLocation.OUTER, rinfo.getEnvelope(), img.getWidth(),
img.getHeight() );
ts = System.currentTimeMillis();
GeoTiffWriter.save( img, geoRef, out );
te = System.currentTimeMillis();
LOG.debug( "Encoding into {} duration {} ms", formatName, te - ts );
} else {
LOG.debug( "Rendering without spatial information, because no envelope is availible. Using ImageIO" );
write( img, formatName, out );
}
}
}