Solved

getting RGB data from a BMP

Posted on 2003-12-11
5
338 Views
Last Modified: 2013-11-20
Hello people
I want to manipulate the RGB data for a windows BMP for image processing so how do i get the RGB array/matrix from a BMP image pleas help
0
Comment
Question by:cyberizen
[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
5 Comments
 
LVL 13

Expert Comment

by:SteH
ID: 9920183
Since you are asking in the MFC-TA I suggest to load the bitmap into a CBitmap. Then you can get the RGB values into a buffer using GetBitmapBits:

CBitmap bmp;
HBITMAP hbmp = (HBITMAP) ::LoadImage (AfxGetInstanceHandle (), fileName, IBM_BITMAP, 0, 0, LR_LOADFROMFILE);
bmp.Attach (hbmp);

BITMAP bbmp;

bmp.GetObject (sizeof (bbmp), &bbmp);

DWORD nsize = bbmp.bmWidthBytes * bbmp.bmHeight;

BYTE *buf = new BYTE(nsize);
bmp.GetBitmapBits (nsize, buf);

....

delete buf

0
 
LVL 1

Author Comment

by:cyberizen
ID: 9921640
hello newbie here
well i have the BYTES now what next how do i extract the RED GREEN and BLUE values

0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 11992087
PAQed, with points refunded (50)

Computer101
E-E Admin
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel Use VBA to get user's Mac Address for their computer 5 336
List out all word 7 336
method notes when mouse over in eclipse 5 90
only14 challenge 19 84
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

749 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