Solved

getting RGB data from a BMP

Posted on 2003-12-11
5
329 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
5 Comments
 
LVL 13

Expert Comment

by:SteH
Comment Utility
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
Comment Utility
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
Comment Utility
PAQed, with points refunded (50)

Computer101
E-E Admin
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now