1

Alternatively, how can I simulate this Photoshop affect programmatically?

In Photoshop, I have two layers:

A simple "Magenta" fill, with blend mode Multiply, and Opacity 100%

enter image description here

And a simple "Cyan" fill, with blend mode Multiply, and Opacity 50%

enter image description here

Which looks like this at 100% Opacity btw

enter image description here

The result is a nice 100% opacity purple:

enter image description here

I tried to do what I thought would be the same thing with Pillow:

from PIL import Image, ImageChops

path = './static/images/'
cyan = Image.open(path+'Cyan.png')
magenta = Image.open(path+'Magenta.png')

# set cyan to 50% opacity
cyan.putalpha(127)

# set magenta to 100% opacity
magenta.putalpha(255)

# blend mode multiply??
blend = ImageChops.multiply(magenta, cyan)

blend.save(path+'blend.png')

but the result is this:

enter image description here

Which, in Photoshop, this is what i get if I set BOTH Magenta and Cyan to 50%.

So, what is ImageChops doing differently from Photoshop here? and how can I do what I did in Photoshop.. but in Python? Is there a way to multiply blend two images but to take the higher opacity instead of the lower? Or should I be using some other method entirely?

  • If both layers are set to multiply, what colour is the background layer set to in both instances? – Ghoul Fool Mar 03 '23 at 09:18
  • in photoshop, i have the background layer disabled entirely. but it appears to simulate a white background, because the result changes if I enable the background layer and change it to anything else. https://imgur.com/a/rJPLyU9 – irisshootsface Mar 03 '23 at 13:56
  • in python, the only background in this case is the white background of the site i'm displaying them on. so in both cases, they are white. – irisshootsface Mar 03 '23 at 13:58

0 Answers0