Thread: Get the colours of pixels in a bitmap file

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

    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
    2,119
    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, 02:35 AM
  2. reading BMP files and pixels' colours
    By Xavier in forum C++ Programming
    Replies: 3
    Last Post: 12-16-2005, 05:19 AM
  3. bitmap pixels???????????
    By SuperNewbie in forum Windows Programming
    Replies: 2
    Last Post: 03-23-2004, 01:53 AM
  4. pixels of bitmap
    By SuperNewbie in forum Windows Programming
    Replies: 4
    Last Post: 03-15-2004, 07:56 PM
  5. creating image from pixels stored in file
    By Kristian25 in forum Windows Programming
    Replies: 3
    Last Post: 01-21-2003, 02:08 PM
Website Security Test