ArcGIS Pro 2.6 API Reference Guide
JPEGFormat Class
Members  Example 

ArcGIS.Desktop.Mapping Namespace : JPEGFormat Class
Represents a Joint Photographic Experts Group (JPEG) format object that can be used to export a MapView, MapFrame, or a Layout.
Syntax
public class JPEGFormat : ExportFormat 
Public Class JPEGFormat 
   Inherits ExportFormat
Remarks
JPEG files are compressed image files. They support 24-bit color and are a popular choice for use on the web because a JPEG file size is often substantially smaller than many other image formats. However, the JPEG compression algorithm is lossy and is not recommended for many map images, as line drawings, and text or icon graphics become blurred by compression artifacts. Therefore, PNG is usually a superior format for map images. JPEGs can be generated with an accompanying world file for use as georeferenced raster data.
Example
The following examples demonstrate how to export a Layout, a MapFrame, and a MapView to JPEG format.
//This example demonstrates how to export a layout to JPEG.

//Added references
using ArcGIS.Desktop.Core;                         //Project
using ArcGIS.Desktop.Layouts;                      //Layout classes
using ArcGIS.Desktop.Framework.Threading.Tasks;    //QueuedTask
using ArcGIS.Desktop.Mapping;                      //Export formats

public class ExportLayoutToJPEGExample
{
  public static Task ExportLayoutToJPEGAsync(string LayoutName, string Path)
  {
    //Reference a layoutitem in a project by name
    LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals(LayoutName));
    if (layoutItem == null)
      return Task.FromResult<Layout>(null);

    //Create JPEG format with appropriate settings
    JPEGFormat JPEG = new JPEGFormat();
    JPEG.Resolution = 300;
    JPEG.OutputFileName = Path;

    return QueuedTask.Run(() =>
    {
            //Export Layout
            Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem
            if (JPEG.ValidateOutputFilePath())
      {
        lyt.Export(JPEG);
      }
    });
  }
}
//This example demonstrates how to export an individual map frame on a layout to JPEG.

//Added references
using ArcGIS.Desktop.Core;                         //Project
using ArcGIS.Desktop.Layouts;                      //Layout classes
using ArcGIS.Desktop.Framework.Threading.Tasks;    //QueuedTask
using ArcGIS.Desktop.Mapping;                      //Export formats

public class ExportMapFrameToJPEGExample
{
  public static Task ExportMapFrameToJPEGAsync(string LayoutName, string MFName, string Path)
  {
    //Reference a layoutitem in a project by name
    LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals(LayoutName));
    if (layoutItem == null)
      return Task.FromResult<Layout>(null);

    //Create JPEG format with appropriate settings
    JPEGFormat JPEG = new JPEGFormat();
    JPEG.HasWorldFile = true;
    JPEG.Resolution = 300;
    JPEG.OutputFileName = Path;

    return QueuedTask.Run(() =>
    {
            //Export MapFrame
            Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem
            MapFrame mf = lyt.FindElement(MFName) as MapFrame;
      JPEG.OutputFileName = Path;
      if (JPEG.ValidateOutputFilePath())
      {
        mf.Export(JPEG);
      }
    });
  }
}
//This example demonstrates how to export the active mapview to JPEG.

//Added references
using ArcGIS.Desktop.Framework.Threading.Tasks;    //QueuedTask
using ArcGIS.Desktop.Mapping;                      //MapView and Export formats

public class ExportActiveMapToJPEGExample
{
  public static Task ExportActiveMapToJPEGAsync(string Path)
  {
    return QueuedTask.Run(() =>
    {
            //Reference the active map view
            MapView map = MapView.Active;

            //Create JPEG format with appropriate settings
            JPEGFormat JPEG = new JPEGFormat();
      JPEG.Resolution = 300;
      JPEG.Height = 500;
      JPEG.Width = 800;
      JPEG.HasWorldFile = true;
      JPEG.OutputFileName = Path;

            //Export active map view
            if (JPEG.ValidateOutputFilePath())
      {
        map.Export(JPEG);
      }
    });
  }
}
Inheritance Hierarchy

System.Object
   ArcGIS.Desktop.Mapping.ExportFormat
      ArcGIS.Desktop.Mapping.JPEGFormat

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 7

See Also

Reference

JPEGFormat Members
ArcGIS.Desktop.Mapping Namespace