Get the colours of pixels in a bitmap file

This is a discussion on Get the colours of pixels in a bitmap file within the Windows Programming forums, part of the Platform Specific Boards category; How would i get the colours and x,y positions of a bitmap with win32 programming?...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    317

    Get the colours of pixels in a bitmap file

    How would i get the colours and x,y positions of a bitmap with win32 programming?

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    1,624
    The easy way:
    Load bitmap using the "LoadImage()" function.
    Associate its HBITMAP with a compatible HDC, via "CreateCompatibleDC()" & "SelectObject()".
    Use "GetPixel()" to get the COLORREF value of a pixel.
    The fast way:
    Load color info on an array by your own( have to know the basic of BMP format )
    By finding the correct triplet, you'll have the RGB( or rather BGR ) values of that pixel.
    There are other ways too.
    Devoted my life to programming...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. bitmap file ..
    By mad_muppet in forum C Programming
    Replies: 2
    Last Post: 05-22-2011, 01:35 AM
  2. reading BMP files and pixels' colours
    By Xavier in forum C++ Programming
    Replies: 3
    Last Post: 12-16-2005, 04:19 AM
  3. bitmap pixels???????????
    By SuperNewbie in forum Windows Programming
    Replies: 2
    Last Post: 03-23-2004, 12:53 AM
  4. pixels of bitmap
    By SuperNewbie in forum Windows Programming
    Replies: 4
    Last Post: 03-15-2004, 06:56 PM
  5. creating image from pixels stored in file
    By Kristian25 in forum Windows Programming
    Replies: 3
    Last Post: 01-21-2003, 01:08 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21