Re: How do I add colorize a black & white image?
- From: "justin creasy" <justin.creasy@xxxxxxxxx>
- Date: 26 Oct 2006 18:18:12 -0700
If all you are trying to do is apply a red, blue, or green hue that
matches how much grey is in the image that is not too difficult. First
you need to determine what format your gray image is in. This is
because different image formats have different sizes. The BitmapData
class will have the necessary information here. Once you have a
numerical value for how much gray there is you can set the correct
color to that amount. To do that you do the following.
- create an empty Bitmap the same size as your gray one.
- iterate through your gray image using your BitmapData object and get
gray value.
- create a pixel in your empty Bitmap with the same amount of whatever
color you want to set as a hue. The byte you add the value to for the
color is reached with your BitmapData object, but how you find the
right byte depends on the image format you use.
- when you're done save your new Bitmap.
Now, this will only work to add one hue to the image, so you'll go from
a gray image to a red image, or a blue image, etc. Hope that helps,
good luck.
MrNobody wrote:
Thanks justin that is a very helpful link.
Would you happen to know where I can go to form some basic color type
questions?
Like what exactly would I have to do to give each pixel a red color but
darkened/lightened depending on how gray it is? Wouldn't I have to change the
RGB value given depending on the shade of gray the pixel is, so the end
result is not just pure saturated color?
.
- References:
- Re: How do I add colorize a black & white image?
- From: justin creasy
- Re: How do I add colorize a black & white image?
- Prev by Date: Re: C# not closing database connections(?)
- Next by Date: Re: Question of a Java programmer
- Previous by thread: Re: How do I add colorize a black & white image?
- Next by thread: Re: Can't add controls on inherited form
- Index(es):
Relevant Pages
|