Simple PNG Color Change or Brightness Increase

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?".
Post Reply
Huntk20
Posts: 3
Joined: 2016-05-06T14:24:20-07:00
Authentication code: 1151

Simple PNG Color Change or Brightness Increase

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

Re: Simple PNG Color Change or Brightness Increase

Post 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
Huntk20
Posts: 3
Joined: 2016-05-06T14:24:20-07:00
Authentication code: 1151

Re: Simple PNG Color Change or Brightness Increase

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

Re: Simple PNG Color Change or Brightness Increase

Post 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
Huntk20
Posts: 3
Joined: 2016-05-06T14:24:20-07:00
Authentication code: 1151

Re: Simple PNG Color Change or Brightness Increase

Post by Huntk20 »

Woww! what an excellent tool! It worked perfectly. Thank you for the amazing support and quick responses fmw42!
Post Reply