How to convert a raster dataset to a JPEG2000 raster dataset

Summary This article shows how to convert a raster dataset to a JPEG2000 file with a specified quality.

Development licensing Deployment licensing
ArcView ArcView
ArcEditor ArcEditor
ArcInfo ArcInfo
Engine Developer Kit Engine Runtime


Converting a raster dataset to a JPEG2000 raster dataset

The following code example can also be applied to save to a Joint Photographic Experts Group (JPEG) and other writable raster formats with a little modification of the compression type and format string:
 

[C#]
static void ConvertToJPEG2000(IRasterDataset rasterDataset, IWorkspace outputWorkspace)

{

//Set storage parameter for compression and quality.

IRasterStorageDef rasterStorage = new RasterStorageDefClass();

rasterStorage.CompressionType = esriRasterCompressionType.esriRasterCompressionJPEG2000;

rasterStorage.CompressionQuality = 50;

//Save out 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 parameter for compression and quality.

Dim rasterStorage As IRasterStorageDef =  New RasterStorageDefClass()

rasterStorage.CompressionType = esriRasterCompressionType.esriRasterCompressionJPEG2000

rasterStorage.CompressionQuality = 50

'Save out to a JP2 file in the output workspace.

Dim saveAs As ISaveAs2 = CType(rasterDataset, ISaveAs2)

saveAs.SaveAsRasterDataset("output1.jp2", outputWorkspace, "JP2",rasterStorage)

End Sub



你可能感兴趣的:(convert)