Select to view content in your preferred language

How to set opacity of exported map image?

752
2
10-19-2010 02:21 PM
JenniferShanks
New Contributor
Hi,

I'm loading an ArcGISDynamicMapServiceLayer into the map with an opacity of .8.  In the javascript viewer, the opacity looks correct.  When I export the map image using the following, the resulting image is 100% opaque.  Does anyone know how I can export the map image with the opacity settings preserved?

Thanks,
Jennifer

   var imageParams = new esri.layers.ImageParameters();
   //add the visible layers to the layerIds array
   imageParams.layerIds = [dynamicMapService.visibleLayers];
   imageParams.layerOption = esri.layers.ImageParameters.LAYER_OPTION_SHOW;
   imageParams.format = "png24";
   imageParams.height = 510;
   imageParams.width = 632;
   imageParams.dpi = 300;
   //get the map image URL
   dynamicMapService.exportMapImage(imageParams, mapImageURLCallback);
0 Kudos
2 Replies
AxelSchaefer
Emerging Contributor
Opacity is done on the client side. The server doesn't have that attribute. That's why you don't have it in your image properties.

Using the opacity slider would be too slow if you have to do a server-roundtrip for every change. Therefore it has to be done on the cilent side.
0 Kudos
JenniferShanks
New Contributor
Hi Axel,

Thanks for the response.   I don't think I gave enough information about what we're trying to accomplish.  Yes, we are using client-side opacity sliders to set opacity of the map within the Javascript application. 

What I need help with is preserving those transparency settings when I export a map image to a PNG for embedding into a PDF.  If I'm only able to export an opaque image, then would I need to use some kind of image processing utility to set the opacity before I load it into the PDF?  I'm using TCPDF /PHP to create the PDF file. 

Thanks for any suggestions!
Jennifer
0 Kudos