[ANN] ColorBlendModes.jl

Hi all,

I’d like to announce ColorBlendModes, an add-on to ColorTypes, just like ColorVectorSpace.
This package provides the definitions and compositing operations of the blend modes.

Examples

using ColorTypes, ColorBlendModes

image_green = load("green.png")
image_blue  = load("blue.png")

blend.(image_blue, image_green, mode=BlendMultiply, opacity=0.75) # broadcasting

Background or Motivation

Currently, ColorVectorSpace does not support the multiplication of two colors such as RGBs. One of the reasons is that the multiplication is ambiguous.
Color types have both aspects as “colors” and as “vectors”. When the aspect as “colors” is important, the multiplication might be the channel-wise (element-wise) product. On the other hand, when the aspect as “vectors” is important, the multiplication might be the dot product or cross product.

An issue is currently open regarding the color math of ColorVectorSpace (cf. Important decisions with respect to color math (please comment) · Issue #126 · JuliaGraphics/ColorVectorSpace.jl · GitHub). (I’m looking forward to your comments!)

So, ColorBlendModes focuses on the aspect as “colors”. and I believe this package will clarify the roles of other packages (e.g. ColorVectorSpace, Colors, ColorTypes).

In this way, the functionality itself of this package is “not” notable. In fact, some graphic libraries (e.g. Cairo) already support the same or similar functionality. This package may work well with other JuliaImages packages since it only provides “pixel” operations and does not have its own rendering buffers, though.

9 Likes