Click here to Skip to main content
13,054,779 members (71,249 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 22:27pm
Rate this: bad
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;
    r = g = b = 0;

of course you could do better.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

visit link
See Topic No 5: Grayscale
Image Processing using C#[^]

Happy Coding!
SoMad 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 4-Apr-13 5:36am
yes it is easy to convert code c# to VB using online converters

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 4 Apr 2013
Copyright © CodeProject, 1999-2017
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