Skip to content

Composites

Scrimage comes with several composites. A composite merges two images with each pixel composited together using the rule provided by the composite class.

This grid shows the effect of compositing a palm tree image over a US mailbox image. The first column is the composite with a value of 0.5f, and the second column with 1f. Note, if you reverse the order of the images then the effects would be reversed.

The code required to perform a composite is simple:

ImmutableImage composed = image1.composite(new XYZComposite(alpha), image2)
val composed = image1.composite(XYZComposite(alpha), image2)
val composed = image1.composite(new XYZComposite(alpha), image2)

Click on an example to see it full screen.

Composite Alpha 0.5f Alpha 1f
average
blue
color
colorburn
colordodge
diff
green
grow
hue
hard
heat
lighten
negation
luminosity
multiply
negation
normal
overlay
red
reflect
saturation
screen
subtract