1

I want to export the Active View with ArcObjects to JPEG. All Layers in the Document are raster layers (GeoTiff).

I use this code which works quite well when in Data View, but when I perform the same export in Layout View, the picture quality is really bad.

Has anyone an idea what the cause of this problem could be?

If I do File -> Export Map picture quality is good in both Data and Layout View. So Esri seems to be doing it differently in ArcMap.

EDIT: kenbuja had the answer. In case somebody needs the C# variant of the method he mentioned, have a look at the esri documentation

1 Answer 1

1

Try setting the output image quality, calling the following subroutine. The iResampleRatio is an value between 1 and 5, with 1 being the highest quality. These correspond with the settings on the export dialog's "output image quality" for vector exports. For image exports, you should always set output image quality to 1 (best).

Private Sub SetOutputQuality(ByVal iResampleRatio As Long)
    Dim pOutputRasterSettings As ESRI.ArcGIS.Display.IOutputRasterSettings = pActiveView.ScreenDisplay.DisplayTransformation
    Dim pGraphicsContainer As ESRI.ArcGIS.Carto.IGraphicsContainer
    Dim pElement As ESRI.ArcGIS.Carto.IElement
    Dim pMapFrame As ESRI.ArcGIS.Carto.IMapFrame
    Dim pTmpActiveView As ESRI.ArcGIS.Carto.IActiveView

    pOutputRasterSettings.ResampleRatio = iResampleRatio

    If TypeOf pActiveView Is ESRI.ArcGIS.Carto.IPageLayout Then

      'assign ResampleRatio to the Maps in the PageLayout
      pGraphicsContainer = pActiveView
      pGraphicsContainer.Reset()
      pElement = pGraphicsContainer.Next
      Do While Not pElement Is Nothing
        If TypeOf pElement Is ESRI.ArcGIS.Carto.IMapFrame Then
          pMapFrame = pElement
          pTmpActiveView = pMapFrame.Map
          pOutputRasterSettings = pTmpActiveView.ScreenDisplay.DisplayTransformation
          pOutputRasterSettings.ResampleRatio = iResampleRatio
        End If

        pElement = pGraphicsContainer.Next
      Loop
    End If
End Sub
1
  • Used the C# variant of this method. Thank you very much, works perfectly Commented Nov 1, 2013 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.