[magick-users] Magick++: Creating clipping mask

Elie Zedeck RANDRIAMIANDRIRAY rez at eliezedeck.com
Mon May 26 10:10:39 PDT 2008


> The fastest solution is Pixels::getConst(x,y,width,height) where typically you
> would process a scanline of pixels at a time.  If this is still not fast
> enough you may want to use some other solution.
Thanks for letting me know about that. But, you guessed it, it's still 
not fast enough for me.

So, I went back to the creation of the clipping mask again. It's a lot 
faster still!

There is something I don't understand in the creation process, which 
makes the final image containing noises.

When I extract all the RGBA channels (Red, Green, Blue, Matte) from the 
Difference image (from DifferenceCompositeOp), and after doing 
threshold(0), the white parts of the mask is not fully white: it 
contains some black dots (usually 1 pixel only) spread around the white 
area.

And when this clipping mask is used, the image has some dotted noises; 
not really noise, but transparencies, because they  black noises.

I have to run despeckle() to get rid of the noises, but despeckle() 
increases the surface of the white area of the clipping mask. So, I get 
a 1 to 2 pixels gap between the original (with transparency noises) and 
the de-noised mask.

Is there something wrong that I did in the clipping mask creation 
process? What should I do to get rid of the noise?

Thanks.



More information about the Magick-users mailing list