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 » 2010-05-11T18:54:07-07:00

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 » 2010-05-11T19:11:57-07:00

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: 21304
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

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

Post by fmw42 » 2010-05-11T19:12:30-07:00

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 » 2010-05-11T20:35:00-07:00

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: 21304
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

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

Post by fmw42 » 2010-05-11T20:40:11-07:00

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