Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ C graphics
Hi
 
I want to get RGB values(5 6 5 format) from each pixel of a bitmap array.
Can someone guide me as how to do this.
 
Thanks
 
[added]
 
I got the solution.
 
Thanks everyone..!!
[/added]
Posted 26-May-10 21:26pm
Edited 26-May-10 23:51pm
CPallini329K
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Did you read the documentation [^]?
 
for instance the following section of BITMAPINFO struct documentation looks promising:
 
A DIB consists of two distinct parts: a BITMAPINFO structure describing the dimensions and colors of the bitmap, and an array of bytes defining the pixels of the bitmap. The bits in the array are packed together, but each scan line must be padded with zeroes to end on a LONG data-type boundary. If the height of the bitmap is positive, the bitmap is a bottom-up DIB and its origin is the lower-left corner. If the height is negative, the bitmap is a top-down DIB and its origin is the upper left corner.
Smile | :)
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Dear,
 
I wish this could be the answer of your question.
 
System.Drawing.Bitmap b = new Bitmap(Image.FromFile("@C:\abc.jpg"));
b.GetPixel(0, 0).R ;
b.GetPixel(0, 0).G;
b.GetPixel(0, 0).B;
 
Thanks
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Can you provide more information? There are many things that you could mean when you say "bitmap".
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Using Lockbits improve the performance, the above solution should work
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 575
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 369
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,466
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,897


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 25 Sep 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100