Dear All,
I have a cell-based image with black background and gradient gray scale foreground, how can I change the foreground gray scale to either red, green, or blue?
Just try to push my wishes further, is there any utilities that I can count how many cells are in a given image?
Thanks in advanced for any help.
--Wo
how to change foreground change
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: how to change foreground change
Can you provide an example image?wchang615 wrote:Dear All,
I have a cell-based image with black background and gradient gray scale foreground, how can I change the foreground gray scale to either red, green, or blue?
Just try to push my wishes further, is there any utilities that I can count how many cells are in a given image?
Thanks in advanced for any help.
--Wo
To change the grayscale to a color you can use +level-color color_for_black,color_for_white
so something like
convert image +level-color black,red graytoredimage
will keep black at black and all shades of gray to white will be some shade of red
See http://www.imagemagick.org/Usage/color/#level-colors
Re: how to change foreground change
Hmmm, how do I attach a sample file without a web server for url?
I tried using +level-colors black,red but somehow can't bring up the gray scale to red.
Thanks for looking into it.
--Wo
I tried using +level-colors black,red but somehow can't bring up the gray scale to red.
Thanks for looking into it.
--Wo
Re: how to change foreground change
Got it! Thanks for your advice for using the +level-colors black,red.
I need to convert the orignal image using "-contrast-stretch 0" first and then with your suggestion.
Thanks!
--Wo
I need to convert the orignal image using "-contrast-stretch 0" first and then with your suggestion.
Thanks!
--Wo
Re: how to change foreground change
Dear All,
I'm trying to do the same using the MagickCore lib but still not quite sure about the parameters. For LevelImageColors:
MagickBooleanType LevelImageColors(Image *image,const ChannelType channel,
const MagickPixelPacket *black_color,const MagickPixelPacket *white_color,
const MagickBooleanType invert)
what are the channel and pixelPacket?
Can someone give me an example how to use this function?
Thanks.
--Wo
I'm trying to do the same using the MagickCore lib but still not quite sure about the parameters. For LevelImageColors:
MagickBooleanType LevelImageColors(Image *image,const ChannelType channel,
const MagickPixelPacket *black_color,const MagickPixelPacket *white_color,
const MagickBooleanType invert)
what are the channel and pixelPacket?
Can someone give me an example how to use this function?
Thanks.
--Wo
Re: how to change foreground change
After some digging and trying, I have the following:
const MagickCore::ChannelType channel = RedChannel;
MagickCore::MagickPixelPacket mpp;
MagickCore::GetMagickPixelPacket(NULL, &mpp);
MagickCore::LevelImageColors (image,channel,&mpp,&mpp,MagickCore::MagickTrue);
Now my question is: how to use this function in a similar way as from the command-line convert using "-level-colors black,red"?
Any help would be greatly appreciated!
--Wo
const MagickCore::ChannelType channel = RedChannel;
MagickCore::MagickPixelPacket mpp;
MagickCore::GetMagickPixelPacket(NULL, &mpp);
MagickCore::LevelImageColors (image,channel,&mpp,&mpp,MagickCore::MagickTrue);
Now my question is: how to use this function in a similar way as from the command-line convert using "-level-colors black,red"?
Any help would be greatly appreciated!
--Wo