Transparency problem
Transparency problem
I'm sure you can understand the problem.
The "1_t.png" file was generated by ImageMagick.
Thanks in advance for any help with this.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Transparency problem
Have no idea what the problem is! What were your two command lines that generated the two images?
Please read viewtopic.php?f=1&t=9620
Please read viewtopic.php?f=1&t=9620
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: Transparency problem
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
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.
See my message in this topic for a link to a zip of all the files.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Transparency problem
el_supremo is correct if that is what you are trying to do
convert inputimage -fuzz XX% -fill black -opaque white outputimage
convert inputimage -fuzz XX% -fill black -opaque white outputimage
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Transparency problem
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!
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!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/