ImageMagick, replace semi-transparent white with opaque white

I have an icon with a fully transparent background and a semi-transparent, white foreground. I would like to make the foreground fully opaque, can this be achieved with ImageMagick?

I have tried juggling different combinations of these;




, but cannot produce the desired result. Any tips?


It would be easier if you posted your icon, but my testing shows that this works for what I think you have:

convert icon.png -channel A -threshold 75% output.png

The above is somewhat coarse as it makes all partially transparent pixels fully opaque. If you wanted to be a bit more surgical, you could only set the opacity to fully opaque when the Red, Green and Blue pixels are greater than 90% and the original opacity (alpha) is between 40%-60% like this:

convert icon.png -channel A \ -fx "(r>0.9 && g>0.9 && b>0.9 && a>0.4 && a<0.6) ? 1.0 : a" output.png

<img src="https://i.stack.imgur.com/37QQP.png" alt="enter image description here">

<img src="https://i.stack.imgur.com/Jik2T.png" alt="enter image description here">


  • C#, dynamically creating picture boxes?
  • TCPDF : font helvetica not work for japanese language
  • ImageMagick not converting
  • How do I improve Rails / Paperclip image compression inside or ImageMagick / Rmagick?
  • How to return a deferred promise and create a model with Ember.Deferred?
  • Simple Yahoo Weather Api Not Working
  • Same code base for WPF and Silverlight?
  • Add chart on phpoffice/phpword
  • Generate random BMP in CLI
  • Hibernate query filter on collection
  • HTML5 video only works in IE. The other browsers shows the black screen
  • Getting media player state in windows phone 7
  • there is no graph with tensorboard
  • Multiple producers single consumer locking schema
  • Why cepheus don't send int without quotes to orion?
  • How to remove a SwiftyJSON element?
  • Access Android Market through SSH tunnel
  • preg_replace Double Spaces to tab (\\t) at the beginning of a line
  • Can you perform a UNION without a subquery in SQLAlchemy?
  • VSO Build — Response status code does not indicate success: 404 (Not Found)
  • Read a local file using javascript
  • NHibernate Validation Localization with S#arp Architecture
  • Cannot connect to cassandra from Spark
  • Getting last autonumber in access
  • Problems to linebreak with an int in JLabel
  • Resize panoramic image to fixed size
  • Volusion's generic SQL folder, functionality
  • Controls, properties, events and timers running in design time
  • Cross-Platform Protobuf Serialization
  • sending/ receiving email in Java
  • Updated Ionic CLI but shows previous version (Windows)
  • Upload files with Ajax and Jquery
  • Alternatives to the OPTIONAL fallback SPARQL pattern?
  • Do I've to free mysql result after storing it?
  • A cron job substitute?
  • json Serialization in asp
  • How do you join a server to an Active Directory (domain)?
  • coudnt use logback because of log4j
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?