|
-
Nov 23rd, 2002, 02:06 PM
#1
Thread Starter
Addicted Member
Image into byte array
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
-
Nov 23rd, 2002, 03:10 PM
#2
Thread Starter
Addicted Member
Re: Image into byte array
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
no one can solve it??
-
Nov 23rd, 2002, 03:15 PM
#3
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"
-
Nov 23rd, 2002, 08:18 PM
#4
Addicted Member
Originally posted by mrdj1002
I wanted to see how to convert a picture variable into byte array and reverce....
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.
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
can i do it with jpg files too? and can i save a picture in picturebox into a jpeg file
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.
Good luck
- Valkan
'You keep creatures in cages and release them to fight? That's sick!'
-
Nov 23rd, 2002, 08:29 PM
#5
Good Ol' Platypus
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.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
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
|