Author Topic: How can i convert multi color to Black and White ??  (Read 2105 times)

majid.ebru

• Sr. Member
• Posts: 365
How can i convert multi color to Black and White ??
« on: October 14, 2017, 08:21:28 pm »
HI
How can i convert multi color to Black and White ?

in image down :
how can i convert blue rang color to black&White rang color ??

thank you

lainz

• Hero Member
• Posts: 2828
Re: How can i convert multi color to Black and White ??
« Reply #1 on: October 14, 2017, 08:56:34 pm »

BeanzMaster

• Full Member
• Posts: 152
Re: How can i convert multi color to Black and White ??
« Reply #2 on: November 14, 2017, 02:59:25 pm »
Very simple

pseudo code :

Code: Pascal  [Select]
1. Const
2.   Thresold = 128;
3.
4. For y:=0 to Img.Height-1
5.   for  x:=0 to Img.Width -1
6.   begin
7.     Pixel := img.GetPixel(x,y);
8.     Intensity := (Pixel.Red+Pixel.Green+Pixel.Blue) div 3;
9.     if intensity <  Thresold then newPixel:= clBlack else newPixel:= clWhite;
10.     BWImg.PutPixel(x,y,NewPixel);
11.  end;
12.

• Hero Member
• Posts: 6899
Re: How can i convert multi color to Black and White ??
« Reply #3 on: November 14, 2017, 04:46:45 pm »
Very simple
It IS simple but not for gray scaling. And that was the question. First answer is correct.
Ada's daddy wrote this:"Fools are my theme, let satire be my song."

BeanzMaster

• Full Member
• Posts: 152
Re: How can i convert multi color to Black and White ??
« Reply #4 on: November 14, 2017, 10:02:08 pm »
The main question is
Quote
How can i convert multi color to Black and White ??
not to grayscale

The 2nd is for grayscale
Quote
how can i convert blue rang color to black&White rang color ??

So by the way now they have the choice
« Last Edit: November 14, 2017, 10:03:51 pm by BeanzMaster »