Trying to colorize png

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
jujube
Posts: 2
Joined: 2015-03-19T13:57:40-07:00
Authentication code: 6789

Trying to colorize png

Post by jujube »

Hi everyone,

I'm looking for a way to colorize PNG image, regardless the PNG's content.
For example, if I take these two differents PNG:

Image Image

and I want to give them a green tint, the output should be:

Image Image

(photoshop approximation)

Any help would be appreciated. :)

IM version 6.7.7-10 2014-03-08 Q16
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Trying to colorize png

Post by snibgo »

This isn't exactly the same as your desired output (Windows BAT syntax):

Code: Select all

convert sr3BsQF.png -modulate 100,0,100 +level-colors rgb(0,50%%,0),lime a.png

convert R8Y94q4.png -modulate 100,0,100 +level-colors rgb(0,50%%,0),lime b.png
snibgo's IM pages: im.snibgo.com
jujube
Posts: 2
Joined: 2015-03-19T13:57:40-07:00
Authentication code: 6789

Re: Trying to colorize png

Post by jujube »

Thank you snibgo !

It does almost what I need :)
It works perfectly well for markers like the first one, but the second marker's colors are flatten..

Image

This one was converted with a simple hex color

convert marker2.png -modulate 100,0,100 +level-colors '#ff8400' result.png
PandoraBox
Posts: 23
Joined: 2011-04-10T14:08:11-07:00
Authentication code: 8675308

Re: Trying to colorize png

Post by PandoraBox »

From the section : http://www.imagemagick.org/Usage/color_ ... dulate_hue

I edited the lines to fit your image that was uploaded.

convert YPuLOBp.png -modulate 100,100,0 YPuLOBp_mod_hue_0.png
convert YPuLOBp.png -modulate 100,100,33.3 YPuLOBp_mod_hue_33.png
convert YPuLOBp.png -modulate 100,100,66.6 YPuLOBp_mod_hue_66.png
convert YPuLOBp.png -modulate 100,100,100 YPuLOBp_mod_hue_100.png
convert YPuLOBp.png -modulate 100,100,133.3 YPuLOBp_mod_hue_133.png
convert YPuLOBp.png -modulate 100,100,166.6 YPuLOBp_mod_hue_166.png
convert YPuLOBp.png -modulate 100,100,200 YPuLOBp_mod_hue_200.png

I'm new to some of the tricks but this one I noticed it when I was making a trip out background for a chroma screen, chances are your looking more for applying a color filter to have them all in the same range.

Only other goodies I found we're at Freds page

http://www.fmwconcepts.com/imagemagick/ ... /index.php Convert your image to grey scale then back to 3 color tints
or http://www.fmwconcepts.com/imagemagick/ ... /index.php which gives you a hue wheel to work with.

Hope this helps or gives ideas to others to point you in the right direction
Post Reply