Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Windows
please help me for that because i want that for my col.protect I thank you very and I wish to communicate with you thank you very much once again and I hope to answer quickly to my request
Posted 3-Apr-13 23:27pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You need first to load the image and then, accessing every single pixel, change it to either black or white RGB values, depending on its current color.
An example on how to perform pixel access (modification included) is in the LockBits[^] LockBits method documentation.
 
A naive col_to_bw method could be:
void col_to_bw( ref byte r, ref byte g, ref byte b )
{
  if ( r*r + g*g + b*b >= 48387) // 48387 = 127*127*3
  {
    r = g = b = 255;
  }
  else
  {
    r = g = b = 0;
  }
} 
 
of course you could do better.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

visit link
See Topic No 5: Grayscale
Image Processing using C#[^]
 
Happy Coding!
Smile | :)
  Permalink  
Comments
SoMad at 4-Apr-13 5:33am
   
That is a great article. The only problem is that the OP asked for VB (.NET) code and the article code is C#. I think it is fine leaving it up to the OP to port the code to VB.
 
Soren Madsen
Aarti Meswania at 4-Apr-13 5:36am
   
yes it is easy to convert code c# to VB using online converters
Thanks

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

  Print Answers RSS
0 OriginalGriff 5,130
1 DamithSL 4,237
2 Maciej Los 3,700
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,846


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 4 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100