Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Color of a Pixel in a image in a pictureBox

Color of a Pixel in a image in a pictureBox

Scheduled Pinned Locked Moved Visual Basic
graphicstutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    charchabil03
    wrote on last edited by
    #1

    Hello how to retrieve the color of a pixel in a image inserted in a picturebox I know that : dim img1 as bitmap (img1.GetPixel(e.Location.X, e.Location.Y).R but im not able to use it within the Picturebox image

    Regards Ramy

    G T 2 Replies Last reply
    0
    • C charchabil03

      Hello how to retrieve the color of a pixel in a image inserted in a picturebox I know that : dim img1 as bitmap (img1.GetPixel(e.Location.X, e.Location.Y).R but im not able to use it within the Picturebox image

      Regards Ramy

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Get the reference of the image from the control, cast it to Bitmap and use the GetPixel method.

      --- single minded; short sighted; long gone;

      C 1 Reply Last reply
      0
      • G Guffa

        Get the reference of the image from the control, cast it to Bitmap and use the GetPixel method.

        --- single minded; short sighted; long gone;

        C Offline
        C Offline
        charchabil03
        wrote on last edited by
        #3

        Guffa wrote:

        Get the reference of the image from the control, cast it to Bitmap and use the GetPixel method.

        get u give me an example plz

        Regards Ramy

        G 1 Reply Last reply
        0
        • C charchabil03

          Guffa wrote:

          Get the reference of the image from the control, cast it to Bitmap and use the GetPixel method.

          get u give me an example plz

          Regards Ramy

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          charchabil03 wrote:

          get u give me an example plz

          If you don't understand what I suggested, just say so. Then I can explain exactly what it is that you don't get. If you don't tell me anything about why you think that an example would help, I can't write an example that would demonstrate what it is that you have problems with. What I suggested is really simple, and I could write the single line of code that does it, but if you don't understand anything about what I suggested, what do you think that you would understand from the code?

          --- single minded; short sighted; long gone;

          1 Reply Last reply
          0
          • C charchabil03

            Hello how to retrieve the color of a pixel in a image inserted in a picturebox I know that : dim img1 as bitmap (img1.GetPixel(e.Location.X, e.Location.Y).R but im not able to use it within the Picturebox image

            Regards Ramy

            T Offline
            T Offline
            The ANZAC
            wrote on last edited by
            #5

            This should do it: Dim x As Integer = Me.PictureBox1.PointToClient(Windows.Forms.Cursor.Position).X Dim y As Integer = Me.PictureBox1.PointToClient(Windows.Forms.Cursor.Position).Y Dim col As Color = Img.GetPixel(x, y)

            Posted by The ANZAC

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups