dst_in and black/white stripes to make sliced 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
danpaluska
Posts: 7
Joined: 2009-09-20T08:01:51-07:00
Authentication code: 8675309

dst_in and black/white stripes to make sliced images?

Post by danpaluska »

i made some stripes with this command:
convert -size 1x100 pattern:gray50 -scale 640x480\! stripesHORZ.gif

composite -compose Dst_In -gravity center stripesHORZ.gif image2.jpg temp1.png
composite -compose Dst_Out -gravity center stripesHORZ.gif image2.jpg temp2.png
convert temp1.png temp2.png -compose Plus -composite sliced.jpg

i want to take two images and make them into a single image by selecting alternate stripes.
i tried this but it doesn't work. i'm assuming the problem is that my stripes are white and black and one of the stripes should be clear instead of black or white.

any tips?

thanks,
dan
danpaluska
Posts: 7
Joined: 2009-09-20T08:01:51-07:00
Authentication code: 8675309

Re: dst_in and black/white stripes to make sliced images?

Post by danpaluska »

i meant

composite -compose Dst_In -gravity center stripesHORZ.gif image1.jpg temp1.png
composite -compose Dst_Out -gravity center stripesHORZ.gif image2.jpg temp2.png

so not a typo problem as far as i know...
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: dst_in and black/white stripes to make sliced images?

Post by fmw42 »

to exaggerate

Image

Image

convert -size 1x8 pattern:gray50 -scale 128x128\! -auto-level stripes.gif
Image

convert zelda3.jpg mandril.jpg stripes.gif -compose over -composite zelda_mandril.jpg
Image

see use of mask image at http://www.imagemagick.org/Usage/compose/
danpaluska
Posts: 7
Joined: 2009-09-20T08:01:51-07:00
Authentication code: 8675309

Re: dst_in and black/white stripes to make sliced images?

Post by danpaluska »

cool.

thanks!

i still don't quite understand all the subtleties as the examples in the usage seem to be for the composite command with 2 input images rather than the convert command with 3 input images. but it works great for me now!

and i'm assuming more will make itself clear to me in time.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: dst_in and black/white stripes to make sliced images?

Post by fmw42 »

danpaluska wrote:cool.

thanks!

i still don't quite understand all the subtleties as the examples in the usage seem to be for the composite command with 2 input images rather than the convert command with 3 input images. but it works great for me now!

and i'm assuming more will make itself clear to me in time.

you can use composite rather than convert by reversing the two input images. The mask is binary and simply selected corresponding area to the white part of one image and the corresponding part to the dark part of the other image and merges them together by making the alternate transparent. White in the mask defines opaque for one image and transparent for the other and black is reversed for the two images.

convert is more modern and flexible than composite, so I tend to use it more as you can do multiple steps in one command where you must separate commands when you use composite.
Post Reply