How to colorize an image?
How to colorize an image?
How do I colorize an image (in the meaning of PSP or PS)?
I mean so it would only have one color in different tones.
I mean so it would only have one color in different tones.
Re: How to colorize an image?
Please see this post and add the extra details: viewtopic.php?f=1&t=9620
Re: How to colorize an image?
Ok... got an image:
Colorize process:
1. Turning it into a greyscale:
2. Colorizing it (for example to green):
3. Output:
Colorize process:
1. Turning it into a greyscale:
2. Colorizing it (for example to green):
3. Output:
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: How to colorize an image?
From a Windows CMD prompt you can get very nearly that result with a command like this...
Code: Select all
convert input.png -colorspace gray -fill green -tint 100 tinted.png
Re: How to colorize an image?
On Debian, but will be the same...
Sorry, I didn't use imagemagick much before... and can't test it now... is "green" a named color? Can I use HTML color instead or something similar?
Sorry, I didn't use imagemagick much before... and can't test it now... is "green" a named color? Can I use HTML color instead or something similar?
Re: How to colorize an image?
You can use:
Name Cyan
HEX #00ffff
You may need use ' around the colour '#00ffff'
RGB rgb\(0,255,255\)
RGBA rgba\(0,255,255,1\)
HSL hsl\(180,100,50\)
HSLA hsla\(180,100,50,1.0\)
CMYK cmyk\(100,0,0,0\)
CMYKA cmyka\(100,0,0,0,100\)
Name Cyan
HEX #00ffff
You may need use ' around the colour '#00ffff'
RGB rgb\(0,255,255\)
RGBA rgba\(0,255,255,1\)
HSL hsl\(180,100,50\)
HSLA hsla\(180,100,50,1.0\)
CMYK cmyk\(100,0,0,0\)
CMYKA cmyka\(100,0,0,0,100\)
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: How to colorize an image?
Yes, "green" is recognized by IM as a color name, and is equal to "rgb( 0, 128, 0)" or "#008000". See THIS PAGE for a list of colors and an explanation of all the ways you can specify colors in IM. Any of these methods should work here.
Re: How to colorize an image?
Thank you!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to colorize an image?
In the OPs screen snap, the hue=75 and saturation=128, do not make a green color. This would be the equivalent of GeeMack's command using HSV values.
You can see that from
# ImageMagick pixel enumeration: 1,1,65535,hsv
0,0: (21845,65535,32896) #55FF80 hsv(120,100%,50%)
Converting % to the range 0 to 255 gives: hsv(120,255,127.5)
What tool was used by the OP in that screen snap to do the colorizing? What is the range of Hue and Saturation values in that tool?
Code: Select all
convert untouched.png -colorspace gray -fill "hsv(120,255,127.5)" -tint 100 result.png
Code: Select all
convert xc:"green" -colorspace hsv -depth 8 txt:
0,0: (21845,65535,32896) #55FF80 hsv(120,100%,50%)
Converting % to the range 0 to 255 gives: hsv(120,255,127.5)
What tool was used by the OP in that screen snap to do the colorizing? What is the range of Hue and Saturation values in that tool?
Re: How to colorize an image?
I've used (and still using) Paint Shop Pro 9 made in 2004 (the best graphics app ever made in my opinion, made by Jasc... when Corel bought it, they've ruined it totally). Hue and Saturation range is 0-255.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to colorize an image?
For hue of 75 that would be 360*75/255=106, which is not green (120). The value of 106 might still be a shade of green. But your saturation seems way off.
See:
Are you sure about the range of saturation in your tool? Might range from -128 to 128 or the like, so that 128 is max saturation?
Those numbers you show just do not make sense
See:
Are you sure about the range of saturation in your tool? Might range from -128 to 128 or the like, so that 128 is max saturation?
Those numbers you show just do not make sense
Re: How to colorize an image?
I am totally sure, checked it to answer your question... both values are 0-255...
BTW... 0 is red as well as 255. You can see a color on bottom of value.
BTW... 0 is red as well as 255. You can see a color on bottom of value.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to colorize an image?
Yes, that makes sense if the range is 0 to 255. In normal hue the range is 0 to 360 with 0 and 360 being the same.BTW... 0 is red as well as 255. You can see a color on bottom of value.
But that means your green color is slightly off as 75->106, but true green is 120. In Imagemagick green not rgb(0,255,0), but is rgb( 0, 128, 0). So a darker green at half the green channel. So its hue should still be 120.
Code: Select all
convert xc:"rgb( 0, 128, 0)" -colorspace hsb -depth 8 txt:
0,0: (21845,65535,32896) #55FF80 hsb(120,100%,50%)
Thus it would be Hue=120 (range 0 to 360) or 120*255/360=85 (not 75), Saturation 100% or 255 and Brightness 50% or 127.5
Your Hue=75:
Code: Select all
convert untouched.png -colorspace gray -fill "hsb(75,100%,50%)" -tint 100 your_green_hsb_75_100_50.png
Hue=85 (true green)
Code: Select all
convert untouched.png -colorspace gray -fill "hsb(85,100%,50%)" -tint 100 true_green_hsb_85_100_50.png
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to colorize an image?
For additional information on specifying colors...
http://www.imagemagick.org/Usage/color_basics/#colors
And for the myriad methods and techniques available in re-coloring images...
http://www.imagemagick.org/Usage/color_mods/
For tinting...
http://www.imagemagick.org/Usage/color_mods/#tinting
http://www.imagemagick.org/Usage/color_basics/#colors
And for the myriad methods and techniques available in re-coloring images...
http://www.imagemagick.org/Usage/color_mods/
For tinting...
http://www.imagemagick.org/Usage/color_mods/#tinting
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/