No announcement yet.

Getting Pixel Color In VB

  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting Pixel Color In VB

    Could someone please tell me how to get the individual pixel color of a document in Photoshop using VB? I have tried it multiple ways and the only way I can truly get it is through the histogram. However, that is extremely slow!

    Any help would be appreciated!

    Thanks in advance,

  • #2
    I can't find anything that simply reads the color, but there is ForegroundColor that can read the foreground color, and there are methods to read CMYK color values (but nothing for RGB).

    So you could conceivably set the foreground color using whatever technique is appropriate, then read it and then reset the foreground to default (or you could even read what it is before, set it, read the setting, and restore what it was before).
    Learn by teaching
    Take responsibility for learning


    • #3
      I don't know anything about the Photoshop <-> VB interface, but in pure VB (at least up to VB6) there is a Point method Point (x, y) that will return the color of the specified pixel as a long integer. From that you can calculate the RGB values as follows:

      r = color And &HFF&
      g = (color And &HFF00&) \ &H100&
      b = (color And &HFF0000) \ &H10000

      Hope this may be of some use...


      • #4
        Is there nothing she doesn't know about?
        Learn by teaching
        Take responsibility for learning


        Related Topics


        • mantra
          is there a color wheel for photoshop cc?
          by mantra

          is there a way to have a color wheel in photoshop to select a color and use it
          to "color balance" an image ?

          i know photoshop color balance adjustamanet layer has 3 sliders

          what i would like to do is
          1) have a color wheel
          06-16-2015, 12:50 AM
        • skydog
          by skydog
          Sometimes I come across a color in a magazine, poster, wall, paint, etc that I like. To use it or know what it is I either take a picture or scan it. Is there an inexpensive device that can take a visual sample of the color and provide the color code?
          11-16-2008, 06:18 PM
        • agrahamt
          Describing a color
          by agrahamt
          I am composing a FAQ to accompany a historical map for which I've added water color as an overlay. The color I've chosen created is rather arbitrary, but I am curious how to describe the color effectively in language. The overlay color is a shade of cyan, but it is 33% transparent with a yellowish...
          07-23-2014, 11:24 AM
        • KR1156
          Any Recommendations?
          by KR1156
          I'm looking to step my game up on color correcting and gaining a better understanding of color theory and color modes....and was just curious if anyone could recommend some books that they have read or heard were great to learn from. I have a pretty good understanding of cmyk since i've been doing...
          06-16-2006, 09:17 AM
        • mantra
          color balance to a specific color,can i do it?
          by mantra

          i have a question about color balance

          i can emulate the color balance , and balance to a specific color

          i thought about a solid color but i can't get the same effect

          in color balance there are 3 sliders , and shadow ,midtones, and hightlight...
          10-07-2010, 01:35 AM