Get Pixel Color in VB.Net 2005 Picture Box

  • Thread starter Thread starter JasonRox
  • Start date Start date
  • Tags Tags
    Information Pixel
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
12 replies · 5K views
Homework Helper
Gold Member
Messages
2,394
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.
 
Physics news on Phys.org
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()
 
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
 
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.
 
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:
 
Thanks!

I can always use more features.
 
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.