If you have access to Adobe Photoshop, they have some real nice filters that you can apply to images to make them look just about any way you could imagine. Makes it a snap.
You could try processing the image yourself pixel by pixel. The colour of each pixel is given by an 8 digit hex number defining the brightness of each of the red, green and blue pixels on a scale of 0 to 255 (&H0 to &HFF). For white this would be &H00FFFFFF,
ie. $H00<Red><Green><Blue>
where red is &HFF, and so is green and blue. (I might have got these colours in the wrong order, but I'm sure you'll soon find out if I have).
Basically, all shades of grey are the colours where the green, red and blue pixels have the same brightness.
So my first idea would besomething like this:-
If you could go through the image pixel by pixel (using the Point method of the picturebox control for example), extract the red, blue and green values of the current pixel, take the average value of these values, and then set the reg, green and blue components to that value. In code this would be something like
Dim x As Integer
Dim y As Integer
Dim iRed As Integer
Dim iBlue As Integer
Dim iGreen As Integer
Dim iAvg As Integer
For y = 0 To pic1.Height
For x = 0 To pic1.Width
iRed = pic1.Point(x, y) And &HFF
iGreen = ((pic1.Point(x, y) And &HFF00) / &H100) Mod &H100
iBlue = ((pic1.Point(x, y) And &HFF0000) / &H10000) Mod &H100
iAvg = (iRed + iBlue + iGreen) / 3
pic1.PSet (x, y), RGB(iAvg, iAvg, iAvg)
Next x
Next y
... assuming you had a picture box called pic1 containing your image. You may also need to set your scalemode to pixels for this to work - I'm not sure....
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.