How to blend 3 pictures together, alternating 10px blocks

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
Ornux
Posts: 3
Joined: 2012-10-30T06:13:41-07:00
Authentication code: 67789

How to blend 3 pictures together, alternating 10px blocks

Post by Ornux »

Hello,

I'm almost new to ImageMagick, trying to use it to blend 3 pictures in a specific way. Let's call them pictures 1, 2 and 3.
The 3 pictures have the exact same resolution.

I'd like to combine them into a single picture alternating 10 (or 5, or 25, whatever) pixels blocks of each one.

The result would be a picture with the same resolution as my input pictures, and would be something like :

Code: Select all

  [1][2][3][1][2][3]
  [2][3][1][2][3][1]
  [3][1][2][3][1][2]
  [1][2][3][1][2][3]
  [2][3][1][2][3][1]
  [3][1][2][3][1][2]
After some investigation, I found that "special compose" might be a way, but I'm not sure how to proceed.


Thanks for any recommendation you have!
~Ornux
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to blend 3 pictures together, alternating 10px block

Post by fmw42 »

My script, interweave, at the link below will do that but only for two images at this time.
Ornux
Posts: 3
Joined: 2012-10-30T06:13:41-07:00
Authentication code: 67789

Re: How to blend 3 pictures together, alternating 10px block

Post by Ornux »

Thank you so much ! :D

Now that I know how to proceed for two images, I will be able to change it so that it works with 3.
Nice scripts database, btw.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to blend 3 pictures together, alternating 10px block

Post by fmw42 »

Ornux wrote:Thank you so much ! :D

Now that I know how to proceed for two images, I will be able to change it so that it works with 3.
Nice scripts database, btw.
You will have to do them two at a time as I don't think masking in -composite works with more than two image. I would do it separately in the X and Y directions. Composite two image with a vertical band mask, shift the mask or recreate it for the third image, then composite that -- all for the X direction. Then repeat with a horizontal band mask.

Might I ask what the purpose is of this result?

Fred
Ornux
Posts: 3
Joined: 2012-10-30T06:13:41-07:00
Authentication code: 67789

Re: How to blend 3 pictures together, alternating 10px block

Post by Ornux »

You will have to do them two at a time as I don't think masking in -composite works with more than two image. [...]
The third image wasn't necessary, so I limited my selection to two and used your script.
Might I ask what the purpose is of this result?
I have several maps with graphical representation (mostly color gradient) of different sets of data. I wanted to be able to gather them in a single one, but a "regular" fusion was unusable.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How to blend 3 pictures together, alternating 10px block

Post by anthony »

There is one other solution. Using a map to select a image index. This uses FX but it does work...
http://www.imagemagick.org/Usage/quantize/#diy_symbols

Yes it uses a tiled lookup of small images, but the images can be of ANY size, including the full size.

If this proves popular, it might even be added as a faster operation of some kind.


If you do use multiple composes, a simple way is to use compostions make appropriate transparent windows in the first two images, then layer the images together (assuming the original images has no transparency).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply