Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Pixel Information

  1. Nov 14, 2006 #1

    JasonRox

    User Avatar
    Homework Helper
    Gold Member

    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.
     
  2. jcsd
  3. Nov 14, 2006 #2
    You can get the color of the pixel at position (x, y) by
    calling the 'Bitmap' objects's 'GetPixel' method.
     
  4. Nov 15, 2006 #3

    JasonRox

    User Avatar
    Homework Helper
    Gold Member

    So, what is that? Like this?

    Systems.Bitmap.GetPixel()
     
  5. Nov 15, 2006 #4
    pf_bitmap = New System.Drawing.Bitmap
    pf_bitmap.GetPixel(1, 1)
     
  6. Nov 15, 2006 #5

    JasonRox

    User Avatar
    Homework Helper
    Gold Member

    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:
     
  7. Nov 16, 2006 #6

    verty

    User Avatar
    Homework Helper

  8. Nov 16, 2006 #7

    JasonRox

    User Avatar
    Homework Helper
    Gold Member

    Thank You!
     
  9. Nov 18, 2006 #8

    JasonRox

    User Avatar
    Homework Helper
    Gold Member

    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?
     
  10. Nov 18, 2006 #9

    NoTime

    User Avatar
    Science Advisor
    Homework Helper

    If you are in VB then you should have the "mousedown" callback for the picturebox.
     
  11. Nov 18, 2006 #10

    JasonRox

    User Avatar
    Homework Helper
    Gold Member

    I'll look into that.

    My program will get better and better. :biggrin:
     
  12. Nov 18, 2006 #11

    DaveC426913

    User Avatar
    Gold Member

  13. Nov 18, 2006 #12

    JasonRox

    User Avatar
    Homework Helper
    Gold Member

    Thanks!

    I can always use more features.
     
  14. Nov 19, 2006 #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.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?