compressionQuality help

92
7
Jump to solution
02-13-2020 09:09 AM
Highlighted
Occasional Contributor

I am using Execute Task (Export Web Map Task) to export an image. js is 4.12. If format is PNG32, the file size is 378k which is rather large for a 400x400 image at 96 dpi. The file size should be closer to 140k. I tried switching to JPG which took the size down to 317k. If I include compressionQuality to operationalLayers there is no change in size. How do I get the image size smaller?

This is a sample request

{"mapOptions":{"showAttribution":false,"extent":{"xmin":479389.87880438194,"ymin":1159369.4997793399,"xmax":479840.91235113516,"ymax":1159594.2281684615,"spatialReference":{"wkid":102659}},"spatialReference":{"wkid":102659},"rotation":0},"operationalLayers":[{"opacity":1,"minScale":0,"maxScale":0,"format":"jpg","compressionQuality":50,"url":"https://www.mymanatee.org/arcgis01/rest/services/basemap/aerials/MapServer"},{"opacity":1,"minScale":0,"maxScale":0,"url":"https://gis.manateepao.com/arcgis/rest/services/Website/WebLayers/MapServer"},{"opacity":1,"minScale":0,"maxScale":0,"url":"https://gis.manateepao.com/arcgis/rest/services/Website/WebLayers/MapServer","layers":[{"id":1,"layerDefinition":{"drawingInfo":{"renderer":{"type":"simple","symbol":{"type":"esriSFS","style":"esriSFSNull","outline":{"type":"esriSLS","style":"esriSLSSolid","color":[66,244,206],"width":3}}}},"source":{"type":"mapLayer","mapLayerId":1},"definitionExpression":"PARID='1014100000'"}}]}],"exportOptions":{"outputSize":[400,400],"dpi":96}}

Tags (1)
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Occasional Contributor II

Using the PNG8 format for the image cuts the file size roughly in half. Some other things to tweak are lowering the opacity or increasing the dpi. The second two do decrease file size, but only slightly.

View solution in original post

7 Replies
Highlighted
Esri Regular Contributor

As far as I can tell, the compressionQuality property only applies when working with an ImageServer. Is there a reason why you need a smaller file size?

References:

Export Image—ArcGIS REST API: Services Directory | ArcGIS for Developers 

imageServiceLayer | ArcGIS for Developers 

Reply
0 Kudos
Highlighted
Occasional Contributor

I'm generating and saving them. The diskspace it's costing us could be halved if the average image size was 150k. 

Reply
0 Kudos
Highlighted
Occasional Contributor II

Using the PNG8 format for the image cuts the file size roughly in half. Some other things to tweak are lowering the opacity or increasing the dpi. The second two do decrease file size, but only slightly.

View solution in original post

Highlighted
Occasional Contributor

Thanks. Changing to PNG8 reduced the image size by 65% without any obvious change in quality. 

PNG8 117k

PNG8

PNG32 331k

PNG32

Highlighted
MVP Esteemed Contributor

Gregory,

  The major difference in PNG8 and PNG32 is that PNG32 supports alpha channel (i.e transparency).

Reply
0 Kudos
Highlighted
Occasional Contributor

Thanks, Robert. I didn't know that. Can you give me an example for why I would need transparency?

Reply
0 Kudos
Highlighted
MVP Esteemed Contributor

If you needed to overlay that image on top of another image.

Reply
0 Kudos