1
$\begingroup$

I want to render greyscale images. I do this with a large script, so I would like to do this in Blender directly and not as postprocessing with another tool.

When I set bpy.context.scene.render.image_settings.color_mode = 'BW', I get greyscale images, but the image is a bit darker. How does Blender compute the greyscale pixel values? It seems not to be the mean over all three channels which I checked.

Indeed, the behavior is somewhat strange: When I save the render in the UI via save as Image it seems to use the maximum value of the color channels. However, when I save the render using bpy.bpy.ops.render.render(write_still=True) the image is different. I am not sure but looking at several pixel values it is always 2 above the minimum, which makes the image darker when one channel has small values.

Can anyone tell me how to correctly export images in greyscale via the python interface?

$\endgroup$
  • $\begingroup$ The Blender compositor can adjust the color completely. The color ramp node can adjust color. You may want to see if the color managment in Blender is affecting the save. Also there are at least 3 acceptable ways of converting to BW. Average Weight, Luminance Weight and Lightness Weight which can be searched. I have not mentioned Python because you may not need any change to your Python. $\endgroup$ – atomicbezierslinger Jul 18 '18 at 17:32
  • $\begingroup$ What is your file format? $\endgroup$ – atomicbezierslinger Jul 18 '18 at 18:31
  • $\begingroup$ This has to do with the rabbit hole of colour management. Best to hunt through the many answers here. $\endgroup$ – troy_s Jul 19 '18 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.