This document is archived and information here might be outdated.  Recommended version.


How to convert a raster dataset to a JPEG2000 raster dataset (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > Developing with ArcGIS > Learning ArcObjects > Managing data > Working with image and raster data > Accessing raster datasets > How to convert a raster dataset to a JPEG2000 raster dataset

How to convert a raster dataset to a JPEG2000 raster dataset


Converting a raster dataset to a JPEG2000 raster dataset

Use the code example in this topic to save to a Joint Photographic Experts Group (JPEG), and other writable raster formats with minor modification of the compression type and format string.
Do the following steps to convert a raster dataset to a JPEG2000 file with a specified quality:
  1. Set storage parameters for compression and quality.
  2. Save to a JP2 file in the output workspace.

    See the following code example:
[C#]
static void ConvertToJPEG2000(IRasterDataset rasterDataset, IWorkspace
    outputWorkspace)
{
    //Set storage parameters for compression and quality.
    IRasterStorageDef rasterStorage=new RasterStorageDefClass();
    rasterStorage.CompressionType =
        esriRasterCompressionType.esriRasterCompressionJPEG2000;
    rasterStorage.CompressionQuality=50;

    //Save to a JP2 file in the output workspace.
    ISaveAs2 saveAs=(ISaveAs2)rasterDataset;
    saveAs.SaveAsRasterDataset("output1.jp2", outputWorkspace, "JP2", rasterStorage);
}
[VB.NET]
Public Sub ConvertToJPEG2000(ByVal rasterDataset As IRasterDataset, ByVal outputWorkspace As IWorkspace)
    'Set storage parameters for compression and quality.
    Dim rasterStorage As IRasterStorageDef=New RasterStorageDefClass()
    rasterStorage.CompressionType=esriRasterCompressionType.esriRasterCompressionJPEG2000
    rasterStorage.CompressionQuality=50
    
    'Save to a JP2 file in the output workspace.
    Dim saveAs As ISaveAs2=CType(rasterDataset, ISaveAs2)
    saveAs.SaveAsRasterDataset("output1.jp2", outputWorkspace, "JP2", rasterStorage)
End Sub


See Also:

How to access a raster dataset




Development licensing Deployment licensing
ArcGIS Desktop Basic ArcGIS Desktop Basic
ArcGIS Desktop Standard ArcGIS Desktop Standard
ArcGIS Desktop Advanced ArcGIS Desktop Advanced
Engine Developer Kit Engine