?
Solved

Red, Green and Blue

Posted on 1998-08-28
2
Medium Priority
?
184 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month8 days, 19 hours left to enroll

764 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