Page 1 of 1
Howto set gradient map on image/photo
Posted: 2009-02-22T06:06:07-07:00
by waza123
How to set Gradient Map (effect) on photo/image ?
Here what i need
Original:
Gradient map (Photoshop):
Thanks.
Re: Howto set gradient map on image/photo
Posted: 2009-02-22T12:46:04-07:00
by fmw42
Convert image to grayscale. Then create a gradient as shown in
viewtopic.php?f=1&t=13147 and apply the gradient using -clut.
convert image.jpg -colorspace gray grayimage.jpg
convert \( -size 1x1 xc:navy xc:yellow xc:navy +append \) \
-filter cubic -resize 256x1! -scale 256x20! gradient_lut.png
specify the colors that make your gradient look the way you want. see
http://imagemagick.org/script/color.php
convert grayimage.jpg gradient_lut.png -clut coloredimage.jpg
Re: Howto set gradient map on image/photo
Posted: 2009-02-22T15:21:08-07:00
by waza123
Big thanks !!! works perfectly !
One more question:
How to use rgb(255, 0, 0) instead of defined words: navy yellow navy ?
In this command
convert \( -size 1x1 xc:navy xc:yellow xc:navy +append \) \
-filter cubic -resize 256x1! -scale 256x20! gradient_lut.png
Re: Howto set gradient map on image/photo
Posted: 2009-02-22T15:23:46-07:00
by fmw42
waza123 wrote:Big thanks !!! works perfectly !
One more question:
How to use rgb(255, 0, 0) instead of defined words: navy yellow navy ?
In this command
convert \( -size 1x1 xc:navy xc:yellow xc:navy +append \) \
-filter cubic -resize 256x1! -scale 256x20! gradient_lut.png
replace
xc:colorname
with
xc:"rgb(XX,YY,ZZ)"
for example for
xc:blue
you would have
xc:"rgb(0,0,255)"
you can also use hex color values
xc:"#0000ff"
see color definitions at
http://imagemagick.org/script/color.php
Re: Howto set gradient map on image/photo
Posted: 2009-02-22T15:36:10-07:00
by waza123
Again Thanks !
And maybe one more question:
i know that the first pixel of image x:1 y:1 is background white
Orig:
Step 1
Is there a way to replace white background of image with transperent background ?
Step 2
I do gradient
Step 3
Replace transperent with black background
Re: Howto set gradient map on image/photo
Posted: 2009-02-22T16:14:27-07:00
by fmw42
waza123 wrote:Again Thanks !
And maybe one more question:
i know that the first pixel of image x:1 y:1 is background white
Orig:
Step 1
Is there a way to replace white background of image with transperent background ?
Step 2
I do gradient
Step 3
Replace transperent with black background
Actually the first pixel is 0,0 in IM.
convert image -transparent white transparentimage.gif (or.png)
do your gradient operation (but not sure how the formerly white area may get changed anyway)
convert gradientimagewithtrasparent -alpha on -channel rgba -fill black -opaque none blackbackgroundimage
Re: Howto set gradient map on image/photo
Posted: 2009-02-26T12:55:57-07:00
by fmw42
I have created a new script, tricolorize, to achieve the original colorization effect.
See
http://www.fmwconcepts.com/imagemagick/index.html
Re: Howto set gradient map on image/photo
Posted: 2009-02-28T18:00:19-07:00
by anthony
I just recently fixed a bug in the
-clut operator that prevented you re-coloring grayscale images using a gradient containing transparent and semi-transparent colors. To use this with
-clut you needed to turn of the matte/alpha channel of the gray-scale image (so there was not alpha values for
-clut to use, so it resorts to using the grayscale component) and set
-channel RGBA.
See IM Examples, CLUT, recoloring with transparency
http://www.imagemagick.org/Usage/color/#clut_rgba
This bug fix is in the latest point release v6.4.9-8