How to set output image quality


Summary
The following function shows how to properly set the Output Image Quality (raster resampling ratio) for a given active view. The output image quality should be set just before exporting or printing at the given output image quality. For the sake of consistency, a developer should always retain the original resampling ratio before changing it and set it back to the original resampling ratio after finishing the export or print task.

Setting output image quality

The following code example uses an IActiveView and a ResampleRatio (resampling ratio). The resampling ratio works the opposite way that you would expect—a value of 1 is the least resampling and, therefore, gives the best output image quality.
[Java]
static void setOutputQuality(IActiveView docActiveView, int iResampleRatio)throws
    Exception{
    /*
     * This function sets the OutputImageQuality for the active view. If the active
     * view is a pagelayout, then it must also set the output image quality for each
     * of the maps in the pagelayout.
     */
    IGraphicsContainer container;
    IElement element;
    IOutputRasterSettings settings;
    IMapFrame mapFrame;
    IActiveView tempActiveView;
    if (docActiveView instanceof IMap){
        settings = (IOutputRasterSettings)docActiveView.getScreenDisplay()
            .getDisplayTransformation();
        settings.setResampleRatio(iResampleRatio);
    }
    else if (docActiveView instanceof IPageLayout){
        // Assign ResampleRatio for PageLayout
        settings = (IOutputRasterSettings)docActiveView.getScreenDisplay()
            .getDisplayTransformation();
        settings.setResampleRatio(iResampleRatio);
        // and assign ResampleRatio to the maps in the PageLayout.
        container = (IGraphicsContainer)docActiveView;
        container.reset();
        element = container.next();
        while (element != null){
            if (element instanceof IMapFrame){
                mapFrame = (IMapFrame)element;
                tempActiveView = (IActiveView)mapFrame.getMap();
                settings = (IOutputRasterSettings)tempActiveView.getScreenDisplay()
                    .getDisplayTransformation();
                settings.setResampleRatio(iResampleRatio);
            }
            element = container.next();
        }
        mapFrame = null;
        container = null;
        tempActiveView = null;
    }
    settings = null;
}






Development licensingDeployment licensing
Engine Developer KitArcGIS for Desktop Basic
ArcGIS for Desktop BasicArcGIS for Desktop Standard
ArcGIS for Desktop StandardArcGIS for Desktop Advanced
ArcGIS for Desktop AdvancedEngine