Click here to Skip to main content
15,886,422 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Kindly tell me how to convert jpg color image to black and whirte image in vb.net windows application with good quality.
Posted
Comments
Sergey Alexandrovich Kryukov 15-Nov-11 2:21am    
What exactly do you mean by black and white? Gray scale or not? What did you try? What's the problem?
--SA

There is a tutorial on this here: http://www.switchonthecode.com/tutorials/csharp-tutorial-convert-a-color-image-to-grayscale[^]
It took a very, very simple Google to find this; why did you not at least try that?
 
Share this answer
 
Try
public Bitmap ConvertToGrayscale(Bitmap source)
{
  Bitmap bm = new Bitmap(source.Width,source.Height);
  for(int y=0;y<bm.height;y++)>
  {
    for(int x=0;x<bm.width;x++)>
    {
      Color c=source.GetPixel(x,y);
      int luma = (int)(c.R*0.3 + c.G*0.59+ c.B*0.11);
      bm.SetPixel(x,y,Color.FromArgb(luma,luma,luma));
    }
  }
  return bm;
}

Reference Link :- convert a colour image to grayscale[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900