03-13-2009 09:22 AM - edited 03-13-2009 09:26 AM
A certain part of my project consists in retreiving an image from a remote machine, which I am doing over TCP using HTTP GET method. The problem is that once I have retreived all the image bits in a char array, I don't know how to transfer it to a Bitmap. The only method I can think of is to create a file with the binary data, and then use GetBitmapFromFile. Is this the only possible way?
P.S. The image is a jpeg, if that's important.
03-13-2009 11:06 AM
If you already have the image bits in an array, you can use the NewBitmap function to create a bitmap object. You don't have to write it to a file first.
Luis
03-13-2009 12:11 PM
03-13-2009 05:16 PM
If it is the case that you are transferring actual jpg file bytes, then you should just be able to do something like the following:
NickB
National Instruments
03-14-2009 12:41 PM
additionally, you may use a library for decoding the jpeg image in memory.
the first such library that comes to my mind is libjpeg which has a windows precompiled binary package here. download the package, include the .lib, and .h, read the doc, and do not forget to put the .dll along with your .exe.
i am pretty sure you can find a lot of similar libraries on the web.