CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2009
    Posts
    55

    displaying bitmap image into a dialog box from a byte array of pixel

    Hi,
    On the dsp side, i need to capture and send an image of size 640*480(RGB bitmap image) to the pc(front end vc++ GUI) through TCP/IP socket communication. On the vc++ side, i need to receive the pixel data of the image and to display it as a picture in the picture control of the dialog box. Initially we tried to write the received pixel values into a file which is stored as a .bmp file format.But when we try to view the image, it says that "it is not a valid bitmap file or its format is not currently supported". When we opened the file using irfan view by adding its corresponding header, we are able to view the image. Then only we realised that the bitmap header is missing and thats why we tried using BITMAPFILEHEADER and BITMAPINFOHEADER. Now can you get any idea about our problem and can you please give me any alternate immediate solution to view the image from the received raw pixel data.

    Thanks in advance...,

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: displaying bitmap image into a dialog box from a byte array of pixel

    You can use SetDIBits.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  3. #3
    Join Date
    Mar 2009
    Posts
    55

    Re: displaying bitmap image into a dialog box from a byte array of pixel

    hi,
    Thanks for your reply. Before when we used SetDIBitsToDevice, we got only the last part of the image that too an inverted image. In the 640*480 frame size image, only a small portion can be viewed. The remaining part is filled with gray image. So can you infer any specific data from the above statements and please be specific in your reply. Can you please send me any code that has involved in the usage of SetDIBits.

    Thanks......

  4. #4
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: displaying bitmap image into a dialog box from a byte array of pixel

    There is some more information about that API on http://msdn.microsoft.com/en-us/library/ms969901.aspx
    Hope it helps you further.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured