* * *

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

majid.ebru

  • Sr. Member
  • ****
  • Posts: 268
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: 2014

Wattanut

  • Newbie
  • Posts: 2
Re: How can i convert multi color to Black and White ??
« Reply #2 on: November 14, 2017, 03:46:15 am »
I want to know the same.

BeanzMaster

  • New member
  • *
  • Posts: 36
Re: How can i convert multi color to Black and White ??
« Reply #3 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.  

   

Thaddy

  • Hero Member
  • *****
  • Posts: 4638
Re: How can i convert multi color to Black and White ??
« Reply #4 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.
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

BeanzMaster

  • New member
  • *
  • Posts: 36
Re: How can i convert multi color to Black and White ??
« Reply #5 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  :P
« Last Edit: November 14, 2017, 10:03:51 pm by BeanzMaster »

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus