ArcGIS API for WPF - Library Reference
ImageFormat Property
See Also  Example Send comments on this topic
ESRI.ArcGIS.Client Namespace > ArcGISImageServiceLayer Class : ImageFormat Property

Gets or sets the image format for the ArcGISImageServiceLayer.

Syntax

Visual Basic (Declaration) 
Public Property ImageFormat As ArcGISImageServiceLayer.ImageServiceImageFormat
C# 
public ArcGISImageServiceLayer.ImageServiceImageFormat ImageFormat {get; set;}

Example

XAMLCopy Code
<esri:Map Name="Map1" Height="400" Width="400" ">
  <!-- ImageFormat Property (Read/Write). -->
  <esri:ArcGISImageServiceLayer 
        Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer" 
        ImageFormat="PNG24"/>
</esri:Map>
<TextBlock Name="TextBlock_ImageFormat" Height="23" Width="248" 
           Text="{Binding ElementName=Map1, Path=Layers[0].ImageFormat}"/>
C#Copy Code
private void MainPage_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
                
  // The Map1 object (a Map object) was defined previously in XAML.
                
  // Create an ArcGISImageServiceLayer.
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer = new ESRI.ArcGIS.Client.ArcGISImageServiceLayer();
  myArcGISImageServiceLayer.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer";
                
  // Set the ImageFormat to PNG24.
  myArcGISImageServiceLayer.ImageFormat = ESRI.ArcGIS.Client.ArcGISImageServiceLayer.ImageServiceImageFormat.PNG24;
                
  // Create an Event Handler.
  myArcGISImageServiceLayer.Initialized += new System.EventHandler<EventArgs>(ArcGISImageServiceLayer_Intialized);
                
  // Add the ArcGISImageServiceLayer to the LayerCollection of the Map.
  Map1.Layers.Add(myArcGISImageServiceLayer);
                
}
                
private void ArcGISImageServiceLayer_Intialized(object sender, EventArgs e)
{
                
  // The Map1 object (a Map object) and TextBlock_ImageFormat (a TextBlock object) were defined previously in XAML.
  
  // Access a specific ArcGISImageServiceLayer.
  ESRI.ArcGIS.Client.ArcGISImageServiceLayer myArcGISImageServiceLayer = (ESRI.ArcGIS.Client.ArcGISImageServiceLayer)Map1.Layers[0];
    
  // ImageFormat Property (Read Only).
  TextBlock_ImageFormat.Text = myArcGISImageServiceLayer.ImageFormat.ToString();
                
}
VB.NETCopy Code
Private Sub MainPage_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
                
  ' The Map1 object (a Map object) was defined previously in XAML.
                
  ' Create an ArcGISImageServiceLayer.
  Dim myArcGISImageServiceLayer As New ESRI.ArcGIS.Client.ArcGISImageServiceLayer
  myArcGISImageServiceLayer.Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer"
                
  ' Set the ImageFormat to PNG24.
  myArcGISImageServiceLayer.ImageFormat = ESRI.ArcGIS.Client.ArcGISImageServiceLayer.ImageServiceImageFormat.PNG24
                
  ' Create an Event Handler.
  AddHandler myArcGISImageServiceLayer.Initialized, AddressOf ArcGISImageServiceLayer_Intialized
                
  ' Add the ArcGISImageServiceLayer to the LayerCollection of the Map.
  Map1.Layers.Add(myArcGISImageServiceLayer)
                
End Sub
                
Private Sub ArcGISImageServiceLayer_Intialized(ByVal sender As Object, ByVal e As EventArgs)
  
  ' The Map1 object (a Map object) and TextBlock_ImageFormat (a TextBlock object) were defined previously in XAML.
                
  ' Access a specific ArcGISImageServiceLayer.
  Dim myArcGISImageServiceLayer As ESRI.ArcGIS.Client.ArcGISImageServiceLayer = Map1.Layers.Item(0)
  
  ' ImageFormat Property (Read Only).
  TextBlock_ImageFormat.Text = myArcGISImageServiceLayer.Description
                
End Sub

Remarks

The default image format is JPG (JPEG). There are four ArcGISImageServiceLayer.ImageServiceImageFormat Enumeration values that can be used for the ImageFormat Property, they are:

  • PNG24
  • JPG
  • PNG8
  • JPGPNG

Support for the JPGPNG format was added at ArcGIS Server 10.0. This format returns a JPG if there are no transparent pixels in the requested extent, otherwise it returns a PNG.

JPG is considered a lossy image type. PNG is considered lossless image types. Theoretical information related to these compression types can be found for the following topics:

Setting the ArcGISImageServiceLayer.NoData Property to a valid pixel value will return an image where the NoData pixel values are displayed as transparent. Transparent pixels can only be displayed when using lossless compression types. Since the default ArcGISImageServiceLayer.ImageFormat is set to JPG, transparent pixel values will not be displayed when the NoData value is set. To display transparent pixels by setting the NoData property, first set the ImageFormat property to either PNG8, PNG24, or JPGPNG.

Requirements

Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© ESRI, Inc. All Rights Reserved.