Page 1 of 1

Simple PNG Color Change or Brightness Increase

Posted: 2016-05-06T14:32:14-07:00
by Huntk20
So I have thousands of PNG icons that I need to change to the color gray. I have messed with ImageMagick for about an hour now and searched around quite a bit with no luck of the examples provided. The main problem I am having is retaining the lightly transparent edges of the icon instead of fully coloring them.

Here is one image example:
Image

Most imaging programs can just increase the brightness of the icon by 100% and it will be for the most part gray. I cannot get that to work in ImageMagick with the following command:

Code: Select all

mogrify -modulate 200,100,100 *.png
Then I attempted the a convert but it ruins the edges badly, obviously because of the -fuzz option:

Code: Select all

convert adjust.png -fuzz 75% -fill gray -opaque black adjust2.png
Any tips to get me what I am after?

Re: Simple PNG Color Change or Brightness Increase

Posted: 2016-05-06T15:17:07-07:00
by fmw42
Are your icons colored or always black? The one you provided is just black.

What is your IM version and platform? Please always provide that information, since syntax may vary.

This works for this icon.

Code: Select all

mogrify -alpha off -channel rgb -evaluate add 50% +channel -alpha on *.png

Re: Simple PNG Color Change or Brightness Increase

Posted: 2016-05-09T09:57:01-07:00
by Huntk20
Sorry, completely forgot to mention the version I am using. It's 7.0.1 the most recent I could find to download. All the icons are black.

I tried your suggested option/command and all it did was turn the entire image into a gray square.

Re: Simple PNG Color Change or Brightness Increase

Posted: 2016-05-09T10:05:06-07:00
by fmw42
On IM 7 you need a change. The following works.

Code: Select all

magick 23mms1w.png -alpha discrete -channel rgb -evaluate add 50% +channel test.png
or for many images:

Code: Select all

magick mogrify -alpha discrete -channel rgb -evaluate add 50% +channel *.png
see http://imagemagick.org/script/porting.php#cli

Re: Simple PNG Color Change or Brightness Increase

Posted: 2016-05-09T10:25:21-07:00
by Huntk20
Woww! what an excellent tool! It worked perfectly. Thank you for the amazing support and quick responses fmw42!