ArcGIS Pro 2.9 API Reference Guide
GetMaterialTexture Method
Example 

ArcGIS.Core.Geometry Namespace > Multipatch Class : GetMaterialTexture Method
The index of the material. Must be greater than or equal to zero and less than MaterialCount. Get the index for a patch by calling GetPatchMaterialIndex.
Gets a byte buffer representing the texture image for the specifed material.
Syntax
public byte[] GetMaterialTexture( 
   int materialIndex
)
Public Function GetMaterialTexture( _
   ByVal materialIndex As Integer _
) As Byte()

Parameters

materialIndex
The index of the material. Must be greater than or equal to zero and less than MaterialCount. Get the index for a patch by calling GetPatchMaterialIndex.

Return Value

Byte buffer representing the texture image for the material. If the material is not textured, an array of size zero is returned.
Exceptions
ExceptionDescription
The material index must be >= 0.
The material index must be less than the number of materials in the multipatch.
Remarks
Calling GetMaterialTextureCompressionType tells you what type of buffer is returned. If the compression type of the buffer is esriTextureCompressionType.CompressionJPEG the buffer is a JPEG image. If the compression type of the buffer is esriTextureCompressionType.CompressionNone the buffer is a pointer to a raw buffer containing image pixels starting from the top left corner in the row major order. The pixel size depends on the GetMaterialTextureBytesPerPixel value. The texture dimensions are returned from GetMaterialTextureColumnCount and GetMaterialTextureRowCount.
Example
// <summary>
// This method gets the material texture image of a multipatch.
// This method must be called on the MCT. Use QueuedTask.Run.
// </summary>
// <param name="multipatch">The input multipatch.</param>
// <param name="patchIndex">The index of the patch (part) for which to get the material texture.</param>
public void GetMultipatchTextureImage(Multipatch multipatch, int patchIndex)
{
  int materialIndex = multipatch.GetPatchMaterialIndex(patchIndex);
  if (!multipatch.IsMaterialTextured(materialIndex))
    return;

  esriTextureCompressionType compressionType = multipatch.GetMaterialTextureCompressionType(materialIndex);
  string ext = compressionType == esriTextureCompressionType.CompressionJPEG ? ".jpg" : ".dat";
  byte[] textureBuffer = multipatch.GetMaterialTexture(materialIndex);

  Stream imageStream = new MemoryStream(textureBuffer);
  System.Drawing.Image image = System.Drawing.Image.FromStream(imageStream);
  image.Save(@"C:\temp\myImage" + ext);
}
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

Multipatch Class
Multipatch Members