ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / GIFFormat Class / HasWorldFile Property
Example Version

HasWorldFile Property (GIFFormat)
Gets or sets if a georeferenced world file will be created.
Syntax
public bool HasWorldFile {get; set;}
Remarks

If set to true, the file will contain pixel scale and real-world coordinate information. World files are not generated for Layout exports.

If you export a 3D view, this parameter will be ignored regardless of the setting because world files are not applicable to 3D views.

(The default value is false)

Example
ExportGIF_MapFrame
//This example demonstrates how to export an individual map frame on a layout to GIF.

//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 ExportMapFrameToGIFExample
{
  public static Task ExportMapFrameToGIFAsync(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 GIF format with appropriate settings
    GIFFormat GIF = new GIFFormat();
    GIF.HasWorldFile = true;
    GIF.Resolution = 300;
    GIF.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;
      GIF.OutputFileName = Path;
      if (GIF.ValidateOutputFilePath())
      {
        mf.Export(GIF);
      }
    });
  }
}
ExportGIF_ActiveMap
//This example demonstrates how to export the active mapview to GIF.

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

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

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

            //Export active map view
            if (GIF.ValidateOutputFilePath())
      {
        mapv.Export(GIF);
      }
    });
  }
}
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also