hi guys
I wanted to see how to convert a picture variable into byte array and reverce.... can i do it with jpg files too? and can i save a picture in picturebox into a jpeg file
thank u
Printable View
hi guys
I wanted to see how to convert a picture variable into byte array and reverce.... can i do it with jpg files too? and can i save a picture in picturebox into a jpeg file
thank u
no one can solve it??Quote:
Originally posted by mrdj1002
hi guys
I wanted to see how to convert a picture variable into byte array and reverce.... can i do it with jpg files too? and can i save a picture in picturebox into a jpeg file
thank u
dangits only up a 1 hour. aren't we impatient!
You won't get many answers on the weekend, especially during the day. A large percentage of the board posters are probably in bed asleep right now due to the time differences in their countries. I can't do it but ive seen a post on this before. check the search function for "picture box and jpeg"
You can get a bit array from a picture object using the GetBimapBits API. Instead of passing to the function a long handle to a bitmap object, pass you picture object instead. Also, you can use the GetObject (api,not vb getobject function) function to get the information of the bitmap. This will help you resize your array to receive the bitmap bits. If you modify this array, you can change the bits of you picture to the one from your array by using SetBitmapBits.Quote:
Originally posted by mrdj1002
I wanted to see how to convert a picture variable into byte array and reverce....
To create a picture object from an array of bytes, you have to first create a compatible bitmap, then set it's bits using SetBitmapBits and then use the OleCreatePictureIndirect function to put this bitmap into the picture object.
note: for information about the API calls i've talked about, go check out allapi.net
The vb LoadPicture function support .jpg files so you could load a jpeg and retreive a bit array from the picture it was loaded in. However this is only for loading and the picture box control can only save bitmap files. If you want to save jpegs, you will need to download an activex or a dll, I think that intel(?) has a free dll that you can download from the net.Quote:
can i do it with jpg files too? and can i save a picture in picturebox into a jpeg file
Good luck :)
- Valkan
Search for GetDIBits and you should get some very recent replies which I have posted - it shows how to get an array from a DC and put it back to that.