Select to view content in your preferred language

Change map contrast/brightness

3312
3
08-27-2010 03:11 AM
AdolfoMarinucci
Deactivated User
Hi all,
I have a project using latest version of ArcGIS SL client API that connects to an ArcGIS Server .net 10. I'm using ArcGISImageServiceLayer and ArcGISDynamicMapServiceLayer classes to shows some map layers.
Is there a way to allow users change at runtime contrast/brightness of resulting images? They need to identify some objects on these maps and this functuonality would be very useful.

Thanks,
Adolfo Marinucci
0 Kudos
3 Replies
AliMirzabeigi
Emerging Contributor
Hi Adolfo,

You can use the following code snippet to change the opacity of an image service layer based upon the value of a Slider control:

<esri:Map x:Name="MyMap" Extent="-13486609,5713307,-13263258,5823117">
            <esri:ArcGISTiledMapServiceLayer Url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" />
            <esri:ArcGISImageServiceLayer Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Portland/CascadeLandsat/ImageServer" 
                                          ImageFormat="PNG8" NoData="0"/>
        </esri:Map>
<Slider x:Name="MySlider" Width="200" HorizontalAlignment="Right" VerticalAlignment="Top" 
            Minimum="0" Maximum="1" Value="1" Margin="0,10,10,0" />
And in the code-behind:

        public MainPage()
        {
            InitializeComponent();

            MyMap.Layers.LayersInitialized += new LayerCollection.LayersInitializedHandler(Layers_LayersInitialized);
        }

        void Layers_LayersInitialized(object sender, EventArgs args)
        {
            MySlider.ValueChanged += MySlider_ValueChanged;
        }

        private void MySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            (MyMap.Layers[1] as ArcGISImageServiceLayer).Opacity = MySlider.Value;
        }
0 Kudos
AdolfoMarinucci
Deactivated User
Thanks for your answer, but what I'm looking for is how to change the contrast/brightness  of the image downloaded not the opacity of the layer. We're working with aereal photos and improving their contrast/brighteness could help our users to identity objects present on the map.

Adolfo
0 Kudos
dotMorten_esri
Esri Notable Contributor
There's an effect property on the layer that you can use for this. There are effects out there that allows you to control contrast and/or brightness.
You can for instance use this effects library: http://wpffx.codeplex.com/

Note that these effects often comes with a big performance penalty, so use them wisely.
0 Kudos