ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / JPEGFormat Class / ImageCompressionQuality Property
Example

In This Topic
    ImageCompressionQuality Property (JPEGFormat)
    In This Topic
    This value (0–100) controls the amount of compression applied to the output image. With a JPEG image, quality is adversely affected the more compression is applied. A higher quality (highest = 100) setting will produce sharper images and larger file sizes. A lower quality setting will produce more image artifacts and smaller files.
    Syntax
    Public Property ImageCompressionQuality As Integer
    public int ImageCompressionQuality {get; set;}
    Remarks
    The default value is 80.
    Example
    Export a map frame to JPG
    {
      //Export a map frame to JPG.
      string filePath = @"Path and file name for the output export file";
      //Create JPEG format with appropriate settings
      //BMP, EMF, EPS, GIF, PDF, PNG, SVG, TGA, and TFF formats are also available for export
      JPEGFormat JPG = new JPEGFormat()
      {
        HasWorldFile = true,
        Resolution = 300,
        OutputFileName = filePath,
        ColorMode = JPEGColorMode.TwentyFourBitTrueColor,
        Height = 800,
        Width = 1200
      };
    
      //Reference the map frame
      MapFrame mf = layout.FindElement("MyMapFrame") as MapFrame;
    
      //Export on the worker thread
      //Note: Must be on QueuesTask.Run
      //Check to see if the path is valid and export
      if (JPG.ValidateOutputFilePath())
      {
        mf.Export(JPG);  //Export the map frame to JPG
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also