Skip to main content
2 of 2
added 105 characters in body
xenoid
  • 17.8k
  • 3
  • 24
  • 38

Gimp is likely overkill (and is a pain to work with for batch...). Although ImageMagick has no color-to-alpha operation, someone came up with a "formula" that works very well:

convert in.png \( -clone 0 -fill "#55f883" -colorize 100 \) \( -clone 0,1 -compose difference -composite -separate +channel -evaluate-sequence max -auto-level \) -delete 1 -alpha off -compose over -compose copy_opacity -composite out.png

Where #55f883 is your background color. Replace convert with magick convert in recent versions.

ImageMagick is the imagemagick package in your distro.

xenoid
  • 17.8k
  • 3
  • 24
  • 38