Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

aged?

Status
Not open for further replies.

jacelyn

Programmer
Feb 1, 2001
20
0
0
SG
is there a formula or any way to make a images look old?
i mean black and white images
 
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.
 
Microsoft Photo editor that comes with Windows98 can tint it sepia and smudge the edges
 
but i onli want it in vb. this is a project given by my lecturer.
i have tried in photoshop alreadi, it work, but i wanted it to be in vb.
 
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....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top