I am using blender as a python module and want to use this trick to get rendering results without saving on the disk: https://ammous88.wordpress.com/2015/01/16/blender-access-render-results-pixels-directly-from-python-2/
The exact code described in the link works when I execute it in the python console of the blender program. However, it does not work, if I simply run it with python or by calling
blender -b -P script.py. In those cases,
bpy.data.images['Viewer Node'].pixels contains 256*256 zeros instead of the rendered cube.
I would appreciate very much any tips concerning what the origin of this difference in behavior is, and how to eliminate it. My guess would be, that some configuration of blender is different when starting the program compared to importing bpy in python, but I have no clue where to search for.