Reputation: 3
Thanks in advance for your help :)
In my code, I load a bitmap from my local computer, receiving in the end an HBITMAP structure. I would like to convert this hBitmap to JPEG and send it to a distant server side socket.
By now, what I am able to fulfill, is to save my picture on disk with jpg format thanks to the CImage functions, and then send it through the network. However, i would like to do it cleanly, not having a temporary file written on disk. My first thought was to send a byte array of the JPEG data, but I don't know how to do it... Any thought?
Following is the snippet of code I use to generate my JPEG file.
hBitmap = (HBITMAP) LoadImage( NULL, "./myfile.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
CImage atlImage;
atlImage.Attach(hBitmap);
atlImage.Save(L"./filename.jpg");
Thanks a lot for any help.
Upvotes: 0
Views: 56