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. Bitmap Deconstruction (AKA: How to get pixel values from a file)

Bitmap Deconstruction (AKA: How to get pixel values from a file)

Scheduled Pinned Locked Moved C / C++ / MFC
graphicstutorialquestion
4 Posts 4 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.
  • M Offline
    M Offline
    Michael Fritzius
    wrote on last edited by
    #1

    Hi all, I'm looking for some snippets of code that show me how to get the individual pixel colors out of a bitmap or other graphic file format. So if it is given a file, it would find out what color each pixel is, and maybe output it to a text file or something. Any ideas? This is for a really cool project for little kids, and I'm excited to get started. Any guidance would be great. Thanks for your time, Michael Fritzius

    N S H 3 Replies Last reply
    0
    • M Michael Fritzius

      Hi all, I'm looking for some snippets of code that show me how to get the individual pixel colors out of a bitmap or other graphic file format. So if it is given a file, it would find out what color each pixel is, and maybe output it to a text file or something. Any ideas? This is for a really cool project for little kids, and I'm excited to get started. Any guidance would be great. Thanks for your time, Michael Fritzius

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      matrix2681 wrote:

      his is for a really cool project for little kids, and I'm excited to get started. Any guidance would be great.

      Using GetPixel[^] is an option. Also you can use ::LoadImage to load a bitmap from file.

      Nibu babu thomas Microsoft MVP for VC++ Code must be written to be read, not by the compiler, but by another human being. Programming Blog: http://nibuthomas.wordpress.com

      1 Reply Last reply
      0
      • M Michael Fritzius

        Hi all, I'm looking for some snippets of code that show me how to get the individual pixel colors out of a bitmap or other graphic file format. So if it is given a file, it would find out what color each pixel is, and maybe output it to a text file or something. Any ideas? This is for a really cool project for little kids, and I'm excited to get started. Any guidance would be great. Thanks for your time, Michael Fritzius

        S Offline
        S Offline
        SandipG
        wrote on last edited by
        #3

        You can use GDI+ for loading the images and use methods LockBits(..)/UnlockBits(..) to get access to pixel data. there are loads of application on CP to help you out few are http://www.codeproject.com/KB/GDI-plus/gdi__and_mfc.aspx[^] http://www.codeproject.com/KB/GDI-plus/cgdiplusbitmap.aspx[^] http://www.codeproject.com/KB/cpp/GDI_.aspx[^]

        Regards, Sandip.

        1 Reply Last reply
        0
        • M Michael Fritzius

          Hi all, I'm looking for some snippets of code that show me how to get the individual pixel colors out of a bitmap or other graphic file format. So if it is given a file, it would find out what color each pixel is, and maybe output it to a text file or something. Any ideas? This is for a really cool project for little kids, and I'm excited to get started. Any guidance would be great. Thanks for your time, Michael Fritzius

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          CImage class has good functions for work with images.

          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