blending options

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
blue-j
Posts: 68
Joined: 2007-06-12T14:03:18-07:00

blending options

Post 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!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: blending options

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
blue-j
Posts: 68
Joined: 2007-06-12T14:03:18-07:00

Re: blending options

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: blending options

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply