Page 1 of 1

Re: Convert black-white image to blue-red

Posted: 2008-11-07T12:43:02-07:00
by fmw42
werty wrote:Hi, I have black&white bitmap, and I need convert it to blue&red, not just change color (black -> blue, white -> red), but all gray gradient. I hope it's clear...

I found 'convert -recolor <matrix>', but I have no idea, how make that transform matrix.

Thanks Radek

Post an example image of your input and desired output (if you have one).

What is not clear is how you want to separate the grayshades into blue and red? Do you want all graylevels below midgray to be blue and all graylevels above midgray to be red? What is the functionality you desire?

Here is one way, but I do not know if this is what you want:

Create gradient:
convert -size 100x100 gradient: grad.png
Image

Change graylevels from b/w to blue/red
convert grad.png +level-colors blue,red grad_blue_red.png
Image

Change graylevels from b/w to red/blue
convert grad.png +level-colors red,blue grad_red_blue.png
Image

Re: Convert black-white image to blue-red

Posted: 2008-11-10T17:44:05-07:00
by anthony
Not however the +level-colors is a new addition to IM. A very useful one. The alternative to this is to either use -clut or a -fx equivelent function. Both methods are also looked at in IM examples, Color Modification