Jump to content
  • Advertisement
Sign in to follow this  
azjerei

How to scan through pixels in a bitmap?

This topic is 5070 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How would I scan through each pixel in a 256 color (8-bit) bitmap and manipulate the RGB values? I want to be able to change colors on the bitmap.

Share this post


Link to post
Share on other sites
Advertisement
azjerei,

Open the file, and retrive the BITMAPFILEHEADER and the BITMAPINFOHEADER. THe *INFOHEADER will tell you the number of bits (ie the object called biBitCount), so use that to read the pixels.

-brad

Share this post


Link to post
Share on other sites
You could grab a library like the one for ImageMagick (http://www.imagemagick.com/www/Magick++/index.html) that will understand the header and get the pixels for you. The advantage to this approach is that you can quickly get access to a wide variety of file formats and functions related to what you want to do.

If you want to do it from scratch, then what the other two responders said would work just fine.

In the end, it's all just the numbers :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!