Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImageMagick colorize command in Linux

I need to change an icon color in a png file, where the icon has a transparent background.

I used the following ImageMagick command:

 convert my_icon.png -fill #de2a2a" -colorize 100 output1.png

In Windows, the command colors the icon without the transparent background.

In Linux, it colors "all the icon" including the transparent background.

Why does this happen? How can I solve this problem in Linux?

The ImageMagick version:

  • Windows: ImageMagick 7.0.4-10 Q16 x64
  • Linux: ImageMagick 6.7.8-9 2016-06-16 Q16

The Icon: enter image description here

Thanks

like image 801
Yosefarr Avatar asked Oct 16 '25 06:10

Yosefarr


1 Answers

On Ubuntu 18.04 (ImageMagick 6.9.7-4) the issue is no longer reproducible. Also tested on MacOS 10.14 (ImageMagick 7.0.8-47).

Command:

convert ~/Desktop/phone.png -fill "#de2a2a" -colorize 100 ~/Desktop/phone-red.png

enter image description here

Note, you have a typo in your command...

-fill #de2a2a"

Should be: (double-quote before the #)

-fill "#de2a2a"

like image 192
tresf Avatar answered Oct 19 '25 06:10

tresf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!