# Why depth map renderings stored in 16-bit PNG turn out to be 8-bit?

I save my rendering results as 16-bit png files using Python as follow:

scene = bpy.context.scene
scene.render.image_settings.color_depth = '16'
scene.display_settings.display_device = 'sRGB'
scene.view_settings.view_transform = 'Raw'
scene.sequencer_colorspace_settings.name = 'Raw'
scene.use_nodes = True
for node in scene.node_tree.nodes:
scene.node_tree.nodes.remove(node)
renderNode = scene.node_tree.nodes.new('CompositorNodeRLayers')

depthOutputNode = scene.node_tree.nodes.new('CompositorNodeOutputFile')
depthOutputNode.format.file_format = 'PNG'
depthOutputNode.format.color_depth = '16'
depthOutputNode.format.color_mode = 'RGB'
depthOutputNode.base_path = 'somePath/'
depthOutputNode.file_slots[0].path = 'fileNameDepth#'

bpy.ops.render.render(write_still=True)


However, it seems that Blender stores/exports the rendering in a different format than I expected. I loaded the images in Python after rendering and I found out that the maximum value for all pixels is not more than 255 (8-bits). Does anyone know why this is the case? I wonder, would storing the depth maps in OpenEXR format resolve the issue?

• What pymodule are you using to open the image? It may not support 16 bit png. I see a 16 bit png saved here. Try opening the image in krita/blender and look at what the image format is. Do you have iv installed? - it is a utility from the openimageio project. – sambler Mar 31 '18 at 5:05
• @sambler I tried a couple of modules by they all assured me that the pixel values never go beyond 255. I tried imageio and scipy.ndimage.imread – Amir Mar 31 '18 at 14:47