Image service ExportScaledImage method

Exports an image to a supported format including JPEG, PNG, BMP, and TIFF. Scales the image into a square pixel size, and returns both the image data and the adjusted image extent for a given image description. Compared to ExportImage, this method exports a MapImage which contains information defined in ImageResult plus the image extent and map scale.

ExportScaledImage(GeoImageDescription ImageDescription, ImageType ImageType)

Parameter

Description

ImageDescription

Defines the properties of the image generated by the service. Pixel data will be processed on-the-fly to fit description properties. The properties you can specify include extent, spatial reference, compression, interpolation, band selection, etc.

ImageDescription also defines a mosaic rule on how mosaic should be performed, and a rendering rule on how the image should be rendered using a MosaicRule and a RenderingRule value objects.

ImageType

Defines the format and the return type of the exported image

Return Value

A MapImage object.

Remarks

If the size of the image exceeds the limit defined in the image service configuration, this method will return an error.

If the pixel type defined in ImageDescription is different from the pixel type of the image service, the pixel values will be converted according to the specified pixel type if possible.

If the image service pixel type cannot be converted to the requested pixel type, a default raster renderer will be applied. A proper default renderer is created using the same rule as when a raster dataset of the same properties, e.g. number of band, pixel type, and etc is added to map. "JPGPNG" format returns a JPG when there are no transparent pixels and otherwise PNG.

Examples

C#

//define image server

string url_DEMService = "http://ais3/arcgis/services/testDEM/ImageServer";

testDTED_ImageServer imageSrv = new testDTED_ImageServer();

imageSrv.Url = url_DEMService;

 

//define image description

GeoImageDescription geoImgDesc = new GeoImageDescription();

geoImgDesc.Height = 600;

geoImgDesc.Width = 800;

geoImgDesc.Interpolation = rstResamplingTypes.RSP_BilinearInterpolation;

ImageServiceInfo isInfo = imageSrv.GetServiceInfo();

geoImgDesc.Extent = isInfo.Extent;

 

//apply a mosaic rule

MosaicRule mosaicRule = new MosaicRule();

mosaicRule.LockRasterID = "1,2,3";

geoImgDesc.MosaicRule = mosaicRule;

 

//define export format

ImageType imgType = new ImageType();

imgType.ImageFormat = esriImageFormat.esriImagePNG;

imgType.ImageReturnType = esriImageReturnType.esriImageReturnURL;

 

//export scaled image

MapImage mapImage = imageSrv.ExportScaledImage(geoImgDesc, imgType);

10/23/2013