-1

Okay guys, I am new to C and I am a trying to construct a 2D array that will hold a BMP image and be able to edit the RGB values. I haven't been able to find anything online about how to access the RGB values or how to put this image in the 2D array and I am really stuck as to where to start. HELP!!!!

WilliamA
  • 29
  • 8

1 Answers1

0

See the reference Writing BMP image in pure c/c++ without other libraries of Ed Heal. Things to note:

  • Define the structures. Don't use arrays of unsigned chars to make the headers as in the referenced post.

  • Both in reading and writing, take care to fill the scanlines. They must be a multiple of four, so the last bytes may not be pixels and contain garbage.

See also my earlier post What is wrong with this code for writing grey-scale bmp from an image RGB bmp pure C - Windows OS which contains the headers and can serve as a partial example.

Community
  • 1
  • 1
Paul Ogilvie
  • 25,048
  • 4
  • 23
  • 41
  • Thanks! I think part of my issue is mainly knowing what to look for. My instructor is extremely non-specific and gave us no examples. We just learned how to use 2D arrays in C and she the gave us this homework that seemed like an extreme logical jump to apply it to images, she didn't even teach us about importing images yet! – WilliamA Feb 07 '16 at 01:59