dognose wrote:This one works pretty well:
convert -background none -page -64-64 zelda3.png -page +0+0 lena2.png -compose blend \
-define compose:args=50,50 -layers merge -alpha off tmp3.png
You are NOT understanding how image layer composition works!!!
Specifically it was really designed with image 'over' composition, and not blending.
NOTE: -composite is only one low level alpha composition of two images (and optional mask)
However ALL the layer commands involving N images actually use N+1 composite operations!!!!
For example....
where ??? is flatten, mosaic, or merge.
This will first look at the two images A, and B, and work out the size of the final image (as appropriate for the layering method which only vary in final image size).
It then creates an image of that size using -background color, and the meta-data of the first image (so as to preserve the first images meta-data).
Only then does it use -compose and -page to overlay A on that canvas, then perform a second compose with B. That is TWO compositions are performed.
So you are first doing a 50% blend of A with the background then making that a 50-50 blend with the second image. The result.. 25% background color 25% A and 50% B
If you want a true 50-50 blend then use -composite, or -average, but 'extend' all the images so they are the same size and positions first!
THE BETTER WAY
As I mentioned previously, the better way is to assigned the appropriate mask/alpha handling of the areas of overlap first, THEN just simply 'over' the images.
A overlay of an image with a 50% alpha transparency with a fully-opaque image will produce the equivalent of a 50-50 blend.
Another Alternative...
make all your images 50% transparent (-channel A evaluate multiply 0.5 +channel). Then 'merge' them with a background of 'none' using a -compose of 'plus'. After the merge turn off alpha. That will also generate a proper blended overlapped set of images, as long as only two images (not three or more) ever overlap.
Code: Select all
convert A B C \
-channel A evaluate multiply 0.5 +channel \
-background none -compose Plus -layers merge \
-alpha off result
Using HDRI you don't even need to do that initial 50%
If images and the result could contain transparency, OR have more than two image overlaps, then you have to actually handle alpha division! to do a proper image mathematics to get this right. --- Better to then use -average (above).