final Dimension defaultTileSize = JAI.getDefaultTileSize();
new ImageWorker(renderedImage).writeTIFF(os, null, 0.75f, defaultTileSize.width, defaultTileSize.height);
}
} else {
GeoTiffFormat format = new GeoTiffFormat();
final GeoTiffWriteParams wp = new GeoTiffWriteParams();
// tiling
wp.setTilingMode(GeoToolsWriteParams.MODE_EXPLICIT);
if(tiled){
wp.setTiling(tileWidth, tileHeight);
} else {
final Dimension defaultTileSize = JAI.getDefaultTileSize();
wp.setTiling(defaultTileSize.width, defaultTileSize.height);
}
final ParameterValueGroup wparams = TIFF_FORMAT.getWriteParameters();
wparams.parameter(AbstractGridFormat.GEOTOOLS_WRITE_PARAMS.getName().toString()).setValue(wp);
final GeneralParameterValue[] wps = (GeneralParameterValue[]) wparams.values().toArray(new GeneralParameterValue[1]);
// write out the coverage
AbstractGridCoverageWriter writer = (AbstractGridCoverageWriter) format.getWriter(os);
if (writer == null)
throw new WPSException(
"Could not find the GeoTIFF writer, please check it's in the classpath");
try {
writer.write(coverage, wps);