Is there some way I can update the viewer node during background rendering to output the correct results? I'm rendering several images from one blender file and I would like to manipulate the pixels of the render output directly. I implemented the workaround from https://blender.stackexchange.com/a/71264/245. Here the pixel values get extracted from the viewer node. 

My problem is, that the viewer node does not get updated when running blender with the -b "background" command line argument. 

Considering the following code to print the max value and the size of the viewer node pixels:

import bpy
import numpy as np
from mathutils import *
from math import *

bpy.context.scene.render.use_compositing = True
bpy.context.scene.use_nodes = True
tree = bpy.context.scene.node_tree
links = tree.links
for n in tree.nodes:
    tree.nodes.remove(n)
rl = tree.nodes.new('CompositorNodeRLayers')
vl = tree.nodes.new('CompositorNodeViewer')
vl.use_alpha = True
links.new(rl.outputs[0], vl.inputs[0])

bpy.ops.render.render()
rl.update()
vl.update()
print(max(np.array(bpy.data.images['Viewer Node'].pixels[:][::4])))
print(len(np.array(bpy.data.images['Viewer Node'].pixels[:][::4])))


when running in background it will print 

0 #print(max(np.array(bpy.data.images['Viewer Node'].pixels[:][::4])))
65536 #print(len(np.array(bpy.data.images['Viewer Node'].pixels[:][::4])))


Instead of the correct values.

is there some way I can update the viewer node during background rendering to output the correct results?
It doesn't look like it's possible at this point, at least not directly through Python:

https://developer.blender.org/T54314