16bit dem image export?

1245
2
10-29-2016 06:16 AM
KonstantinGorskov
New Contributor

Hi! Is there any way (at least theoretically, using python) to export 16bit float image instead of typical 8bit png raster?

Right now I am using this to export:

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
for pageNum in range(1, mxd.dataDrivenPages.pageCount + 1):
mxd.dataDrivenPages.currentPageID = pageNum
arcpy.mapping.ExportToPNG (mxd, r"D:\mosaicrasterdata\FinalExport" + str(mxd.dataDrivenPages.pageRow.Name) + ".png", df,10016,10016,1210, 100, True)
del mxd

but none of the exportToPNG or exportToTIFF has options to deal with 16bit or 32 bit files, selection is only limited to:

  • 24-BIT_TRUE_COLOR —24-bit true color
  • 8-BIT_PALETTE —8-bit palette
  • 8-BIT_GRAYSCALE —8-bit grayscale
  • 1-BIT_MONOCHROME_MASK —1-bit monochrome mask
  • 1-BIT_MONOCHROME_THRESHOLD —1-bit monochrome threshold

Maybe I can somehow obtain that layour image bit data manually and save it to file myself?

0 Kudos
2 Replies
DanPatterson_Retired
MVP Emeritus

depends on how bad you need it and you external skills with python numpy and matplotlib

Can I save a numpy array as a 16-bit image using "normal" (Enthought) python? - Stack Overflow 

and if you have scikit and pil (aka with Pro install of the SciPy stack), there is

https://blog.philippklaus.de/2011/08/handle-16bit-tiff-images-in-python 

Dr Google other options, but most rely on numpy/scipy and builtin or external libraries like pypng

KonstantinGorskov
New Contributor

I am good with coding, so actual export will not be a problem for me. But how to get hold on the actual raw frame data? It would be easy for me, if I could see source file of a arcpy.mapping.ExportToPNG function. Its likely it gets access on the frame image data, properly transformed with all coordinates and e.t.c, and then goes on with saving it. But that is what I can not find anywhere.

0 Kudos