Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. getting RGB values from BMP

getting RGB values from BMP

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelptutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cyberizen
    wrote on last edited by
    #1

    Hello people well i am really having a hard time handling BMPs. My object is to get the RGB values from a BITMAP image which can anything like a 8 16 or 24 bit image. for simplicity i am using just the 24 bit BMP i have used BITMAP HBITMAP and CBitmap class in the end i got the bytes from the 24 bit image like this BYTE *pix = (BYTE*)bm.bmBits; where bm is of type BITMAP but something is wrong when i am drawing the pixels on the screen using the setPixel function i image is not drawn correctly and i dont seem to figure out the problem please help me i need the RGB values for an IMAGE PROCESSING PROJECT i am finding it really hard to get the values and please do not refer to me packages like cximage and stuff i dont want to use any library just tell me how to get the RGB values from a BMP file

    M 1 Reply Last reply
    0
    • C Cyberizen

      Hello people well i am really having a hard time handling BMPs. My object is to get the RGB values from a BITMAP image which can anything like a 8 16 or 24 bit image. for simplicity i am using just the 24 bit BMP i have used BITMAP HBITMAP and CBitmap class in the end i got the bytes from the 24 bit image like this BYTE *pix = (BYTE*)bm.bmBits; where bm is of type BITMAP but something is wrong when i am drawing the pixels on the screen using the setPixel function i image is not drawn correctly and i dont seem to figure out the problem please help me i need the RGB values for an IMAGE PROCESSING PROJECT i am finding it really hard to get the values and please do not refer to me packages like cximage and stuff i dont want to use any library just tell me how to get the RGB values from a BMP file

      M Offline
      M Offline
      Monty2
      wrote on last edited by
      #2

      add the bmp to ur resources then CBitmap bm; bm.LoadBitmap(IDC_BITMAP1); in onpaint CDC memDC; memDC.CreateCompatibleDC(&dc); memDC.SelectObject(&bm); dc.BitBlt(0,0,width,height,&memDC,0,0,SRCCOPY);

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups