-
March 12th, 2013, 12:54 AM
#1
how to convert png image into byte array in VC++??
Hi,
I m loading a png image by using the ATLImage library.
CImage Image;
Image.Load (L"D:\\Images\\PNG_Images\\Image7.png");
how to retrieve the byte array value of this png image.
I tried retrieving it as
byte *png = reinterpret_cast<BYTE *>(Image.GetBits());
but when i access the data , der is a loss of data while converting it in the above manner.
I found a snippet in net for decoding the raw data . but der is a line is the code which is unknown to me.
The code is as follows :
CImage atlImage;
HMODULE hMod = GetModuleHandle(NULL);
atlImage.Load(bstr);
void* pPixel = atlImage.GetBits();
int pitch = atlImage.GetPitch();
int depth = atlImage.GetBPP();
INT32 bytes = (iImageSize.x * depth) / 8;// iImageSize.x is unknown
const BYTE* src = (const BYTE*)pPixel;
BYTE* dst = (BYTE*) pBitmapData; //valid memory buffer
for (int jj = atlImage.GetHeight(); --jj >= 0; )
{
memcpy(dst, src, bytes);
src += pitch;
dst += pitch;
}
How do I get the byte * value form the png image loaded?
Thankx a ton in advance for reply
Regards,
Sandhya .
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|