MirrG
MirrG

Reputation: 406

Blend multiple images with ImageMagic

img1 img2

My problem is the following :

I have several .png files. Each file has a small spot of a certain color. All the files have the same size. My question is how to overlay them together so that the spots of different colors will be a mixture of this colors and one color do not overlap completely the other one? The -flatten option combines images but on the example orange (img1) color will be covered by brown (img2), instead I want a spot of mixing color (brownish).

I tried:

convert -evaluate-sequences mean -- didn't help

convert -layers merge -- didn't help

composite -blend -- help, but can combine only two images

Thanks for any tips

Upvotes: 6

Views: 9034

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 208052

Not sure what your images are like, since you only provided 2 whereas I was expecting two input images and one result!

So, let's make two of our own:

convert -size 200x100 xc:none -fill black -draw "circle 80,50 130,50"  black.png
convert -size 200x100 xc:none -fill orange -draw "circle 120,50 170,50"  orange.png

enter image description here enter image description here

Then I guess you want this:

convert orange.png black.png -compose overlay -composite result.png

enter image description here

Or maybe you mean luminize blend mode:

convert orange.png black.png -compose luminize  -composite result.png

enter image description here

If you want to experiment with other blend modes, you can use:

identify -list compose

to get a list of all of them.

Atop
Blend
Blur
Bumpmap
ChangeMask
Clear
ColorBurn
ColorDodge
Colorize
CopyAlpha
CopyBlack
CopyBlue
CopyCyan
CopyGreen
Copy
CopyMagenta
CopyRed
CopyYellow
Darken
DarkenIntensity
DivideDst
DivideSrc
Dst
Difference
Displace
Dissolve
Distort
DstAtop
DstIn
DstOut
DstOver
Exclusion
HardLight
HardMix
Hue
In
Intensity
Lighten
LightenIntensity
LinearBurn
LinearDodge
LinearLight
Luminize
Mathematics
MinusDst
MinusSrc
Modulate
ModulusAdd
ModulusSubtract
Multiply
None
Out
Overlay
Over
PegtopLight
PinLight
Plus
Replace
Saturate
Screen
SoftLight
Src
SrcAtop
SrcIn
SrcOut
SrcOver
VividLight
Xor

If you want to check them all:

for b in $(identify -list compose); do convert -gravity center -pointsize 72 -label "$b" orange.png black.png -compose $b -composite  miff:- ; done | montage -geometry +0+0 miff: montage.png

enter image description here

Upvotes: 39

Related Questions