How can I interlace two images

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
ffleader1
Posts: 2
Joined: 2016-04-01T05:20:56-07:00
Authentication code: 1151

How can I interlace two images

Post by ffleader1 »

So i have two image of the same size. I want to combine them by taking the odd lines from the first image, the even lines from the second image, and put them together.
How should I do it?
(Using ImageMaick on Command Prompt for Windows)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How can I interlace two images

Post by snibgo »

I would "-composite" with a mask that has alternating black and white lines.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How can I interlace two images

Post by fmw42 »

For unix (Linux, Max OSX or Window w/Cygwiin) see my script interweave at the link below:

Code: Select all

interweave -m row -b 1 zelda3.jpg peppers2.jpg result.png
ffleader1
Posts: 2
Joined: 2016-04-01T05:20:56-07:00
Authentication code: 1151

Re: How can I interlace two images

Post by ffleader1 »

I got the solution. Thanks for those who helped :D
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How can I interlace two images

Post by fmw42 »

Assuming your images are the same size, then make a one row black image and a one row white image (the same width as your images) and append them vertically (-append). Then tile that out to the height of your two images (-tile or tile:). Then use the result as a mask image to composite (-compose over ... -composite) the two input images together.
Post Reply