This document is archived and information here might be outdated. Recommended version. |
ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > II > IImageServer Interface > IImageServer.GetImage Method (ArcObjects .NET 10.4 SDK) |
Gets an image for a given image description.
[Visual Basic .NET] Public Function GetImage ( _ ByVal pImageDescription As IGeoImageDescription _ ) As Byte[]
[C#] public Byte[] GetImage ( IGeoImageDescription pImageDescription );
[C++]
HRESULT GetImage(
IGeoImageDescription* pImageDescription,
pData* pData
);
[C++]
Parameters pImageDescription [in]
pImageDescription is a parameter of type IGeoImageDescription pData [out, retval] pData is a parameter of type
Gets the image data in byte array from the image service using the given GeoImageDescription.
Gets the image data for a given image description. The returned image data contains first pixel values and then followed by NoData (transparency) bit mask, i.e. <pixels><mask>. The pixel values are organized in a band interleaved by pixel format, as the following:
v[0,0,0], v[1,0,0], v[2,0,0],…, v[nBands-1,0,0],
v[0,0,1], v[1,0,1], v[2,0,1],…, v[nBands-1, 0,1], …,
v[0,nRows-1,nCols-1], …, v[nBands-1,nRows-1,nCols-1]
where nCols, nRows, and nBands are the number of columns, number of rows, and number of bands of the returned image, and v[b,I,j] is a pixel value at band number b, row number I, and column number j. The size in terms of number of bytes of a pixel value depends on pixel type. The following table shows the pixel type to pixel size mapping:
PT_U1 1
PT_U2 1
PT_U4 1
PT_UCHAR 1
PT_CHAR 1
PT_USHORT 2
PT_SHORT 2
PT_ULONG 4
PT_LONG 4
PT_FLOAT 4
PT_DOUBLE 8
The location of the pixel at band b, row I, and column j can be calculated using the following formula:
location = ((i*nCols+j)*nBands+b)*pixelsize (in bytes)
The pixel data are always in Intel (Little Endian) byte order. For pixel types of more than 1 byte, byte swapping may be needed.
The NoData mask is a bit mask, one bit per pixels of all bands, with no padding to the byte boundary for a row. Value 1 indicates the pixel is valid, and 0 indicates NoData. The mask value for a pixel at row I and column j can be calculated as the following:
Bit[]={0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}
l = i*nCols+j
m[l/8] & Bit[l%8]
The NoData immediately follows pixel data. The size of NoData mask in bytes is (nCols*nRows+7)/8.
The NoData mask is optional. If the total size of the returned image data greater than the pixel data size i.e. nRows*nCols*nBands*pixelsize, then the NoData mask is present.
If LZ77 compressed, the returned image data must be uncompressed (zlib). The uncompressed image data follow the same format as above.
If JPEG compressed, the returned image data are organized as JPEG data stream followed NoData mask, and followed by the size of the JPEG stream, i.e. <JPEG><mask><size>. The NoData mask is the same format as above, but is LZ77 compressed. The JPEG data stream size <size> is a 4-byte integer in Intel byte order.