I stand corrected by Anthony. The proper usage is:


convert example_rgb_gap.jpg \
          \( +clone -separate \
            -background white -compose darken -flatten \
            -threshold 0 \) \
          -compose multiply -composite example_rgb_gap_proc.jpg

Anthony's comments on my suggestion below - corrected above:

So not specifying      -background white
is NOT a good idea. Other wise it will default to the first images
background meta-data setting, or if not present, the IM default of
white.   In other words   DO NOT OMIT IT.

And yes while  -threshold 1  will generally work, especially for Q16,
where a value of '1' is even smaller than for a Q8 IM, but it is not
correct.  It was only correct for a VERY small version release, until IM
Examples picked up on the change.




Actually there is a simpler way, thanks to Anthony Thyssen:

convert example_rgb_gap.jpg \
        \( +clone -separate -compose darken -flatten -threshold 1 \) \
        -compose multiply -composite example_rgb_gap_proc3.jpg





try

convert example_rgb_gap.jpg -separate example_rgb_gap_%d.png
convert example_rgb_gap_0.png example_rgb_gap_1.png \
        -compose darken -composite example_rgb_gap_01.png
convert example_rgb_gap_2.png example_rgb_gap_01.png \
        -compose darken -composite -threshold 1 example_rgb_gap_mask.png
convert example_rgb_gap.jpg example_rgb_gap_mask.png \
        -compose multiply -composite example_rgb_gap_proc.jpg




The attachment on my last post didn't go through.  An example of what
I am describing can be found here:

http://www.magicpancakes.com/example_rgb_gap.jpg

Hello all,
I'm writing with what should be a relatively simple task.  I've never
tried to do anything beyond simple conversions, resizing, composites,
etc. using IM, so I'm sort of a newbie.
I am starting with three individual images, representing R G and B
bands that I combine into a single RGB image.  In the resulting
image, the individual bands do not line up properly (an issue
inherent in the individual bands, not anything that I can control).
I've attached a small section as an example.
I want to set the entire region to 0 while preserving the surrounding
areas where the RGB pixel value is correct.  In other words, if the
value is 0 on an individual band, it should be 0 in the final image.
I have been playing with fx statements, but I'm having trouble with
syntax, and it is SLOW.
I know there must be a simple and FAST solution.  Perhaps creating a
mask from the individual bands and then applying it over the RGB
image?  I need to run this as a step in a script to process many of
these images (~11 mb each).
Thanks for any suggestions.
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to