I'm trying to paste image B over image A with half opacity (i.e. pasted image is half transparent).
In version 2.1.0 of pillow the following code worked, in version 3.3.1 it no longer works:
A = Image.open('A.png')
B = Image.open('B.png')
enhancer = ImageEnhance.Brightness(B)
mask = enhancer.enhance(0.5)
print(mask.getpixel((10,10)), mask.getpixel((30,30)))
mask.save('Mask.png')
A.paste(B, (0,0), mask)
A.save('Result.png')
Image A is a black 'A' on a white background
Image B is a red 'B' on a transparent background
Images are provided below
Version 2.1.0 produces (127,0,0,127) for pixel 30,30 of the mask
Version 3.3.1 produces (127,0,0,255) for pixel 30,30 of the mask