how to convert binary martix in the black and white image in C C++ - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


how to convert binary martix in the black and white image in C C++

hi i am working in image processing.
i am using C++ for fast execution.
i am new in C++.
now i want to generate black and white image from binary metrix.
as per exam pal
in matrix when i write 1 it gives me black and 0 means white


gives me output



i.e whenever 1 is there it highlighted with black.
plz any body give ma code for this or any direction for this


  • LundinLundin Posts: 3,711Member
    What OS are you writing code for?
    What is an "image"? Graphical presentation on the screen? A bitmap?
  • daxesh87daxesh87 Posts: 3Member
    windows XP

    yes a bitmap image
  • LundinLundin Posts: 3,711Member
    First, note that this is [italic]not[/italic] a beginner's task. You will have to write the output from the program binary into a file, creating the bitmap from scratch. The kind of bitmap you are interested in is known as DIB, Device Independant Bitmap.

    If you have a Windows compiler that will help a lot, since the Windows API comes with pre-made structs called BITMAPFILEHEADER and BITMAPINFOHEADER.

    Bitmaps are documented here:

    Good link:
  • daxesh87daxesh87 Posts: 3Member
    sir can u plz send ma code for this
    b'coz i dont know much in this
    so plz help me
    and send it as soon as possible b'coz i had presentation on same
    on friday 25th sep.
    theory i already read from your link
    it is realy good one
    thanx for your reply
    plz reply soon.
    thank you again.
    daxesh patel

Sign In or Register to comment.