changing the whole color of a png icon preserving the edges alpha

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?".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: changing the whole color of a png icon preserving the edges alpha

Post by fmw42 »

Use sparse-color to make a two point gradient. See https://imagemagick.org/Usage/canvas/#t ... _gradients

Code: Select all

magick icon.png -channel RGB -sparse-color barycentric '0,0 blue 0,%h red' -alpha on icon2.png
artech
Posts: 10
Joined: 2018-10-08T09:10:04-07:00
Authentication code: 1152

Re: changing the whole color of a png icon preserving the edges alpha

Post by artech »

Thank you both for quick answers. Worked like a charm.
Post Reply