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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

image question

Status
Not open for further replies.

cyberwolf14

Programmer
Aug 27, 2001
65
BE
How do i now the color of a pixel of an image??

For example I have a picturebox with a picture
now how do i now the color of a pixel of the picture


pls help me
 
Hi

Set the scalemode of the picturebox to vbpixels.
There is 2 methods you can use:

1)
color = Picture1.Point(X, Y) 'returns a long representing the color

2)
Private Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long) As Long
color = GetPixel(Picture1.hDC, X, Y) 'returns a long representing the color


Method 2 is much faster than method 1, so use that if you have a large picture or many repetitions.

Sunaj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top