The following example shows various ways of adding and multiplying images. The given example uses 3D images but the functionality generalizes for 2D images.
Adding and multiplying images
First I make different two example images that have the same dimensions
or try a = test_image_3d(2), a = test_image(0) etc - see the test image gallery.
Add/multiply/subtract/divide images and store the result in a new image
Add/multiply b to/against a and store it in a
Subtract b from a and store it in a
In [11]: c = b*-1 # multiply b by negative one In [12]: a.add(c) # equivalent to subtracting b from a