int** to CImage to png file
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums
Results 1 to 3 of 3

Thread: int** to CImage to png file

  1. #1
    Join Date
    Apr 2008

    int** to CImage to png file

    I have an array of RGB values that I use to draw an image on screen. I need to save that image to a png file.

    I've looked at the usual candidates - libpng and the like, and they all seem to suffer from the usual Win32 multi-threaded non-threaded debug release problem. I'd really like to not have to bother with that problem.

    So, I see that he CImage class can write png files. Ace. What I can't work out is how to load a CImage with RGB values from my ordinary array in order to write the output to a png file. Can anyone point me in the right direction?

  2. #2
    Join Date
    Feb 2005

    Re: int** to CImage to png file

    Have you looked at the GetBits() member function? That retrieves a pointer to the actual bitmap buffer.

  3. #3
    Join Date
    Jun 2002
    Stockholm, Sweden

    Re: int** to CImage to png file

    ...or loop and call SetPixel or SetPixelRGB to assign each pixel.

    Or, you can use CImage::BitBlt to copy all the image data from a device context. You may be able to use a CBitmap (+SetBitmapBits) selected into the device context you are copying the data from.
    Nobody cares how it works as long as it works

Tags for this Thread

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This a survey!

On-Demand Webinars (sponsored)