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?".
Presumably you're trying to turn the white background in the left image into either black or transparent background.
Either way you need to add -fuzz to the command
See: http://www.imagemagick.org/script/comma ... s.php#fuzz
The easiest way is to use a percentage such as: -fuzz 15%
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
With hair the problem becomes much more difficult than a simple fuzz factor.
You either still leave a light colored halo, OR you loose small strands of hair.
Some form of anti-aliased background removal is needed, to re-generate the background. However you need to generate two values for each pixel to re-generate that background. the original color of the 'hair' are each point, and the amount of transparency to give that point.
The hair layered on a single white background will not provide enough info to do this properly. However if you have two images, on layered on white, the other on say black, then it should be posible to determine the original color and transparency of each pixel.
That is for each pixel you have two colors, one layered on white, the other on black. From this you should be able to determine the original alpha, and color components.
I have not determined the mathematics for this, but it is something I have a strong interest in solving, as an alternative and perfect way to restoring an images original transparency.
PS: an overlay of the same image on any two different known colors should allow you to (in general) restore an images transparency perfectly!