Sign in to follow this  
azjerei

How to scan through pixels in a bitmap?

Recommended Posts

azjerei    100
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
Galapaegos    277
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
Metaphorically    146
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this