We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
i am currently working on a project that needs to blend an image exaclty in the way photoshop does with the Blend Mode "COLOR". As i read in the documentation in Processing there are only the following blend modes available:
Either BLEND, ADD, SUBTRACT, DARKEST, LIGHTEST, DIFFERENCE, EXCLUSION, MULTIPLY, SCREEN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, DODGE, or BURN
I was hoping that someone maybe already did this before and wrote Image Processing code that i could use.
Here is an example what i attempt to get:
external link: f.666kb.com/i/cpzb6ox97wy6ilh3n.jpg
Adobe describes this blending mode with following words:
"Color - Result color has luminosity of the underlying color, and hue and saturation of the source color. This blending mode preserves the gray levels in the underlying color. This blending mode is useful for coloring grayscale images and for tinting color images."
(source: helpx.adobe.com/after-effects/using/blending-modes-layer-styles.html)
Can someone help me? Unfortunately for my task i exaclty need this specific mode.
Answers
Are you looking for tint()?
@PhiLho
no, .tint() creates a different effect unfortunately. I'm looking for a Blending Mode that isn't currently supported by blend(...) [1] / blendMode(...) [2].
I think i may have to implement the algroithm myself but i would prefer an existing version. I for sure can't implement efficently like a pro :)
I found an existing implementation here: https://github.com/sroucheray/sroucheray-as3/blob/master/pixelbender/blend_mode/Color.pbk it just has to be ported to Java/Processing.
[1] processing.org/reference/blend_.html
[2] processing.org/reference/blendMode_.html
Here are the formulas for all the photoshop blending modes:
http://www.simplefilter.de/en/basics/mixmods.html
For the COLOR blending mode using pixel operations in Processing, I think it's a good idea to switch to colorMode(HSB, ...).
Also have you found this GLSL implementation for Processing?
http://forum.processing.org/two/discussion/1292/photoshop-blend-modes-now-in-processing/p1
OK, I was confused because you show only one image and the result, while blend usually takes two images to blend together.
Which is confirmed by the wonderful page pointed out by amnon: not only the formula are useful, but the explanations make clear what operation is done.
If we choose the color blending based on brightness (instead of luminance), indeed using the HSB mode (or the related hue(), saturation() and brightness() functions) is an easy way to get this effect.
@amnon
thanks for your answer! It's exactly what i've been lookin for. The Shader works perfect.