IRasterBandCollection.SaveAs Method (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (DataSourcesRaster)  

IRasterBandCollection.SaveAs Method

Creates a new persistent RasterDataset with the bands in the collection.

[Visual Basic .NET]
Public Function SaveAs ( _
    ByVal new_name As String, _
    ByVal worksp As IWorkspace, _
    ByVal Format As String _
) As IDataset
[C#]
public IDataset SaveAs (
    string new_name,
    IWorkspace worksp,
    string Format
);
[C++]
HRESULT SaveAs(
  BSTR new_name,
  IWorkspace* worksp,
  BSTR Format
);
[C++]

Parameters new_name [in]
new_name is a parameter of type BSTR worksp [in]
worksp is a parameter of type IWorkspace* Format [in]
Format is a parameter of type BSTR

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Functional License Check

If your application/site is not appropriately licensed, SaveAs can return an error of E_RASTER_FILE_LZW_FAILED.

Remarks

The SaveAs method can create a raster dataset in Imagine, TIFF, GRID, JPEG2000, JPEG, BMP, GIF, PNG, PCI Raster, USGS ASCII DEM, X11 Pixmap, Memory Raster and geodatabase raster.

The format strings used for the supported formats are below, and they are case sensitive:

Format Name String Used
Imagine "IMAGINE Image"
TIFF "TIFF"
GRID "GRID"
JPEG "JPG"
JP2000 "JP2"
BMP "BMP"
PNG "PNG"
GIF "GIF"
PCI Raster "PIX"
X11 Pixmap "XPM"
PCRaster "MAP"
Memory Raster "MEM"
HDF4 "HDF4"
BIL "BIL"
BIP "BIP"
BSQ "BSQ"
Idrisi Raster Format "RST"
ENVI Raster Format "ENVI"
Geodatabase Raster "GDB"

The format string "TIFF" creates a TIFF file with ".tif" extension. ArcGIS also supports TIFF format with ".tiff" and ".tff" extensions. A format string "TIF" creates a  TIFF file with ".tiff" extention and a format string "TFF" creates a TIFF file with ".tff" extension.

 

 

Note, SaveAs will return a RasterDataset, to prevent from SaveAs holding the output, .NET ReleaseCOMObject needs to be called to release the referene to the output raster dataset:

    System.Runtime.InteropServices.Marshal.ReleaseComObject(outRasterDS);

See Also

IRasterBandCollection Interface