Page 1 of 1

blending options

Posted: 2007-06-12T14:21:17-07:00
by blue-j
hello folks, hope everyone is having a good day. i'm rwiting because i want to replicate some of the blending options in photoshop using IM (python API). in photoshop, if you double-click on a layer that has another one underneath it, you get the "Layer Style" dialog box, which has Blending Options. I'm interested in the "Blend If:" area only, where you define the brightness range of pixels on the topmost layer and how it will blend with the underlying layer. You choose what channels to use (I want to use the composite RGB channels), and I want to use define the brightness levels of the top layer only for blending. I would love to define a range of partially blended pixels as you can in Pshop by option- or alt-clicking and splitting the sliders. here's a quote from the Pshop CS2 user guide that further details what i'm trying to achieve:

"Use the This Layer sliders to specify the range of pixels on the active layer that will blend, and therefore appear, in the final image. For example, if you drag the white slider to 235, pixels with brightness values higher than 235 will remain unblended and will be excluded from the final image."

Image

is this functionality possible with IM? i can't figure it out. thanks soooo much for your time in considering this problem!

Re: blending options

Posted: 2007-06-12T19:07:41-07:00
by anthony
That is a masked blend. You generate a mask of the area you want to blend.

However at the moment this only works with an 'over' of image without transparency.
It is a feature that has been broken in IM for a very long time...

See Composite Mask Bug Page
http://www.imagemagick.org/Usage/bugs/composite_mask/
whcih shows how this should be implemented.

It basically is not implemented as the only current solution (other what is available) uses 'masks' which only uses purely black and white masks.

I am starting to find that IM internally needs to be able to define more than just the current RGB and CMYK image formats in memory. It also needs bitmap and greyscale image formats, and posibily YUV channel formats. But then I am raving again. Better put away my soapbox.

Re: blending options

Posted: 2007-06-13T00:19:13-07:00
by blue-j
thanks so much! could IM theoretically generate the mask/alpha image on the fly as well, given parameters?

"However at the moment this only works with an 'over' of image without transparency"

what do you mean by "an 'over' of image without transparency"?

also, is there any developer out there who could make such a functionality work for payment? my company might fund such a development! i hope this offer isn't inappropriate.

Re: blending options

Posted: 2007-06-13T00:27:39-07:00
by anthony
See the pointer to the bugs page. It also shows how to do a proper masked blend, that can be used when images also contain some transparency.

This is a very old problem that should have been fixed long ago.