Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Red, Green and Blue

Posted on 1998-08-28
2
Medium Priority
?
186 Views
Last Modified: 2010-04-30
If I open an image using picturebox/imagebox. Is there any way I can get the R, G, and B value of each single pixel?
0
Comment
Question by:YL
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
clifABB earned 400 total points
ID: 1431608
Yes, using the Point() method will give you the RGB value, the following code will give you the individual values:

  Dim lRes  As Long
  Dim sColor As String
  Dim nRed  As Integer
  Dim nGrn  As Integer
  Dim nBlu  As Integer
 
  lRes = Picture1.Point(1, 1)
  sColor = Right$("000000" & Hex$(lRes), 6)
  nRed = Val("&H" & Mid$(sColor, 5, 2))
  nGrn = Val("&H" & Mid$(sColor, 3, 2))
  nBlu = Val("&H" & Mid$(sColor, 1, 2))
  Debug.Print nRed, nGrn, nBlu

0
 

Author Comment

by:YL
ID: 1431609
Thanks, clifABB. I will try the codes you sent me later. I was using getBitmap and setBitmap but get only one value for each pixel. (suppose have three). That's why I need your help.
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question