How to change logo color

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
satimis
Posts: 30
Joined: 2017-04-13T19:20:03-07:00
Authentication code: 1151

How to change logo color

Post by satimis »

Hi all,

I have a logo .png file (only words) in red color with transparent background.

Is there a command line to change the color of the words from red to yellow? Please advise. Thanks

Regards
satimis
satimis
Posts: 30
Joined: 2017-04-13T19:20:03-07:00
Authentication code: 1151

Re: How to change logo color

Post by satimis »

Hi all,

Following command helps me out:
⟫ convert traces_of_life_10_en.png -fuzz 15% -fill yellow -opa
que "#c03030" traces_of_life_10_en_yellow.png

I found it on Internet

Could you please help me to understand;
-fuzz 15%
-opaque "#c03030"
?

Thanks

satimis
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to change logo color

Post by snibgo »

Documentation of the options is at http://www.imagemagick.org/script/comma ... ptions.php

"-opaque {colour}" means "change pixels that are currently {colour} to the fill colour".

If fuzz was zero, only pixels that were exactly {colour} would be changed. With a fuzz of 15%, all colours that were within 15% of {colour} are changed.
snibgo's IM pages: im.snibgo.com
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: How to change logo color

Post by GeeMack »

satimis wrote: 2017-12-14T02:15:58-07:00I have a logo .png file (only words) in red color with transparent background.

Is there a command line to change the color of the words from red to yellow?
Depending on your version of IM one or both of these should do what you describe...

Code: Select all

convert logo.png -fill yellow -colorize 100 logo_out.png

Code: Select all

convert logo.png ( +clone -fill yellow -colorize 100 ) +swap -compose copyopacity -composite logo_out.png
If you're on a *nix platform you'll have to escape those parentheses with backslashes like "\( ... \)".

It's always best if you provide your version of IM and what platform you're working on.
satimis
Posts: 30
Joined: 2017-04-13T19:20:03-07:00
Authentication code: 1151

Re: How to change logo color

Post by satimis »

GeeMack wrote: 2017-12-14T06:58:56-07:00
satimis wrote: 2017-12-14T02:15:58-07:00I have a logo .png file (only words) in red color with transparent background.

Is there a command line to change the color of the words from red to yellow?
Depending on your version of IM one or both of these should do what you describe...

Code: Select all

convert logo.png -fill yellow -colorize 100 logo_out.png

Code: Select all

convert logo.png ( +clone -fill yellow -colorize 100 ) +swap -compose copyopacity -composite logo_out.png
If you're on a *nix platform you'll have to escape those parentheses with backslashes like "\( ... \)".

It's always best if you provide your version of IM and what platform you're working on.
Hi,

Thanks for your advice.

I found following command on Internet;

Code: Select all

$ convert input_file.png -fuzz 15% -fill '#xxxx' -opaque "#c03030" output_file.png
I only substituted '#xxxx' with yellow, then it worked for me without problem.

I have another logo same as the first one with only words in green color and transparent background but;

Code: Select all

$ convert input_file.png -fuzz 15% -fill red -opaque "#c03030" output_file.png
couldn't work and the green color remained unchanged.

Then I increased 15% to 80%. It worked changing the logo color to red.

I can't understand why I need to increase -fuzz?

Your recommended 2 command lines work for me but I prefer the first one. It is easy to remember.

$ convert --version

Code: Select all

Version: ImageMagick 6.8.9-9 Q16 x86_64 2017-07-31 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png rsvg tiff wmf x xml zlib
Thanks

Regards
satimis
satimis
Posts: 30
Joined: 2017-04-13T19:20:03-07:00
Authentication code: 1151

Re: How to change logo color

Post by satimis »

snibgo wrote: 2017-12-14T06:31:04-07:00 Documentation of the options is at http://www.imagemagick.org/script/comma ... ptions.php

"-opaque {colour}" means "change pixels that are currently {colour} to the fill colour".

If fuzz was zero, only pixels that were exactly {colour} would be changed. With a fuzz of 15%, all colours that were within 15% of {colour} are changed.
Hi,

Thanks for your advice and link.
"-opaque {colour}" means "change pixels that are currently {colour} to the fill colour".
"#c03030" is not the color of my logo. It was in the command line which I found on Internet. But without changing it the command line still worked? Why?

Regards
satimis
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to change logo color

Post by snibgo »

I guess, because your logo colour is within 15% of #c03030.
snibgo's IM pages: im.snibgo.com
satimis
Posts: 30
Joined: 2017-04-13T19:20:03-07:00
Authentication code: 1151

Re: How to change logo color

Post by satimis »

snibgo wrote: 2017-12-15T05:08:48-07:00 I guess, because your logo colour is within 15% of #c03030.
Noted and thanks

satimis
Post Reply