Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

getting RGB data from a BMP

Posted on 2003-12-11
5
Medium Priority
?
342 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

722 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