Collage images with blend

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
dognose
Posts: 265
Joined: 2005-03-08T22:16:37-07:00

Collage images with blend

Post by dognose » 2018-10-01T05:33:02-07:00

Hi All,

I'm looking to do a 2x2 collage with overlapping / blended edges.

I can't figure out an easy way to do the overlap / blend part. Any suggestions?

snibgo
Posts: 12153
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Collage images with blend

Post by snibgo » 2018-10-01T06:15:09-07:00

Blending can be done with a masked "-compose Over -composite". For example, blending horizontally between x=120 and x=180, with a linear blend (Windows syntax):

Code: Select all

magick ^
  toes.png ^
  ( toes.png -negate ) ^
  ( +clone -sparse-color bilinear "120,0,White 180,0,Black" ) ^
  -compose Over -composite ^
  blnd_neg.jpg
Image

See Blending pyramids for some other blending techniques.

Instead of blending, we can make a jagged cut that is the line of least difference between the images:

Code: Select all

magick ^
  toes.png ^
  ( toes.png -negate ) ^
  ( -clone 0-1 ^
    -compose Difference -composite ^
    -process darkestpath ^
    -fill White -draw "color 0,0,floodfill"
  ) ^
  -compose Over -composite ^
  blnd_neg2.jpg
Image

See Dark paths for more detail.
snibgo's IM pages: im.snibgo.com

Post Reply