ArcGIS Pro 2.6 API Reference Guide
TGAFormat Class
Members  Example 

ArcGIS.Desktop.Mapping Namespace : TGAFormat Class
Represents a Truevision Graphics Adaptor (TGA) object that can be used to export a MapView, MapFrame, or a Layout.
Syntax
public class TGAFormat : ExportFormat 
Public Class TGAFormat 
   Inherits ExportFormat
Remarks
TGA files have historically been used for content that is meant to be used in other applications (for example, image sprites for animated games) and is read and written by many popular graphic arts applications.
Example
The following examples demonstrate how to export a Layout, a MapFrame, and a MapView to TGA format.
//This example demonstrates how to export a layout to TGA.

//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 ExportLayoutToTGAExample
{
  public static Task ExportLayoutToTGAAsync(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 TGA format with appropriate settings
    TGAFormat TGA = new TGAFormat();
    TGA.Resolution = 300;
    TGA.OutputFileName = Path;

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

//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 ExportMapFrameToTGAExample
{
  public static Task ExportMapFrameToTGAAsync(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 TGA format with appropriate settings
    TGAFormat TGA = new TGAFormat();
    TGA.Resolution = 300;
    TGA.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;
      TGA.OutputFileName = Path;
      if (TGA.ValidateOutputFilePath())
      {
        mf.Export(TGA);
      }
    });
  }
}
//This example demonstrates how to export the active mapview to TGA.

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

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

            //Create TGA format with appropriate settings
            TGAFormat TGA = new TGAFormat();
      TGA.Resolution = 300;
      TGA.Height = 500;
      TGA.Width = 800;
      TGA.OutputFileName = Path;

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

System.Object
   ArcGIS.Desktop.Mapping.ExportFormat
      ArcGIS.Desktop.Mapping.TGAFormat

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 7

See Also

Reference

TGAFormat Members
ArcGIS.Desktop.Mapping Namespace