Get Pixel Color in VB.Net 2005 Picture Box

  • Thread starter Thread starter JasonRox
  • Start date Start date
  • Tags Tags
    Information Pixel
Click For Summary
To retrieve the color of a pixel in a picture box using VB.Net 2005, the 'GetPixel' method of the Bitmap object is utilized. The syntax involves creating a Bitmap object and calling the method with specific coordinates, such as pf_bitmap.GetPixel(1, 1). Additionally, to capture the pixel location of a mouse click on the Picture Box, the "mousedown" event can be implemented. Resources like MSDN and specialized forums such as Tek-Tips and VBForums are recommended for further assistance and feature enhancements in VB development.
JasonRox
Homework Helper
Gold Member
Messages
2,381
Reaction score
4
Hey!

Does anyone know how to get the "color" of a pixel in a picture box, in VB.Net 2005?

I want to encode things into an image, and then later pull the information out of the pixels.
 
Technology news on Phys.org
You can get the color of the pixel at position (x, y) by
calling the 'Bitmap' objects's 'GetPixel' method.
 
Greg Bernhardt said:
You can get the color of the pixel at position (x, y) by
calling the 'Bitmap' objects's 'GetPixel' method.

So, what is that? Like this?

Systems.Bitmap.GetPixel()
 
pf_bitmap = New System.Drawing.Bitmap
pf_bitmap.GetPixel(1, 1)
 
Greg Bernhardt said:
pf_bitmap = New System.Drawing.Bitmap
pf_bitmap.GetPixel(1, 1)

Thank you!

I'm going to try it out right now.

Oh yeah, what kind of information will it give me? That's another thing. :frown:
 
http://msdn2.microsoft.com/en-us/library/system.drawing.bitmap.getpixel(VS.80).aspx
 
Thank You!
 
I have another question.

Now, what is the code to get the pixel that you clicked on?

So, you have a Picture Box.

If you click on it, how can I get the pixel location of where that click was?
 
If you are in VB then you should have the "mousedown" callback for the picturebox.
 
  • #10
NoTime said:
If you are in VB then you should have the "mousedown" callback for the picturebox.

I'll look into that.

My program will get better and better. :biggrin:
 
  • #11
  • #12
Thanks!

I can always use more features.
 
  • #13
There is a highly specialized VB forum available here

http://www.vbforums.com/

I used it back when I did VB 6.0 developmnet, nowdays I am a Java man.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 19 ·
Replies
19
Views
3K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 8 ·
Replies
8
Views
3K
Replies
16
Views
4K
Replies
8
Views
5K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K