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

Gets or sets the image format used when generating an ArcGISDynamicMapServiceLayer image.

Syntax

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

Example

XAMLCopy Code
<esri:Map Background="White" HorizontalAlignment="Left" Margin="5,5,5,5" Name="Map1" 
             VerticalAlignment="Top" Height="200" Width="400" BorderThickness="5" BorderBrush="#FF30EBEB">
            
       <!-- Set the ImageFormat to JPG. The default value for the service is PNG24. -->
       <esri:ArcGISDynamicMapServiceLayer 
             Url="http://sampleserver1.arcgisonline.com:80/arcgis/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer" 
             ImageFormat="JPG" />
             
   </esri:Map>
C#Copy Code
private void ArcGISDynamicMapServiceLayer_Initialized(object sender, System.EventArgs e)
{
    // The myArcGISDynamicMapServiceLayer (an ArcGISDynamicServiceLayer object) and TextBlock_ImageFormat
    // (a TextBlock object) were defined previously in the XAML or code-behind.
                 
    // Get the first layer in the LayerInfo collection. 
    ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer = (ArcGISDynamicMapServiceLayer)Map1.Layers[0];
    
    // ImageFormat (Read/Write).
    
    // Set the .ImageFormat to JPG. The default value for the service is PNG24.
    myArcGISDynamicMapServiceLayer.ImageFormat = ArcGISDynamicMapServiceLayer.RestImageFormat.JPG;
    
    // Get the .ImageFormat property.
    TextBlock_ImageFormat.Text = myArcGISDynamicMapServiceLayer.ImageFormat.ToString();
}
VB.NETCopy Code
Private Sub ArcGISDynamicMapServiceLayer_Initialized(ByVal sender As System.Object, ByVal e As System.EventArgs)
    ' The myArcGISDynamicMapServiceLayer (an ArcGISDynamicServiceLayer object) and TextBlock_ImageFormat
    ' (a TextBlock object) were defined previously in the XAML or code-behind.
    
    ' Get the first layer in the LayerInfo collection. 
    Dim myArcGISDynamicMapServiceLayer As ArcGISDynamicMapServiceLayer = Map1.Layers.Item(0)
    
    ' ImageFormat (Read/Write).
    
    ' Set the .ImageFormat to JPG. The default value for the service is PNG24.
    myArcGISDynamicMapServiceLayer.ImageFormat = ArcGISDynamicMapServiceLayer.RestImageFormat.JPG
    
    ' Get the .ImageFormat property.
    TextBlock_ImageFormat.Text = myArcGISDynamicMapServiceLayer.ImageFormat.ToString
End Sub

Remarks

The default image format is PNG24. There are four ArcGISDynamicMapServiceLayer.RestImageFormat Enumeration values that can be used for the ImageFormat Property, they are:

  • PNG24
  • JPG
  • PNG8
  • PNG32

The background color for an ArcGISDynamicMapServiceLayer will always be transparent when the ImageFormat is set to use a lossless data compression such as PNG. JPG is considered a lossy data compression and as such will not show the background of the layer to be transparent, meaning it will not drape well over other background layers. Theoretical information related to these compression types can be found for the following topics:

Requirements

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

See Also

© ESRI, Inc. All Rights Reserved.