By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,988 Members | 1,367 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,988 IT Pros & Developers. It's quick & easy.

Save Image data into a file

P: 3
Hi,
I have an image file and I have to store the image data into an existing file in binary. How do I do this in VB?
thanks.
Sep 21 '07 #1
Share this Question
Share on Google+
4 Replies


VBPhilly
P: 95
Hi,
I have an image file and I have to store the image data into an existing file in binary. How do I do this in VB?
thanks.
the only way I am aware of is not related to a file but uses a sql server database (there is a binary datatype).

however, try opening the image in a text editor and you should see that it is already in binary format.
Sep 21 '07 #2

QVeen72
Expert 100+
P: 1,445
Hi,

Open the Image in "Binary File " Mode, Read using "Get" and save in TextFile using "Put"
Check this :

Expand|Select|Wrap|Line Numbers
  1. Dim TStr As String
  2. Dim FN As Long
  3. FN = FreeFile 
  4. Open "C:\MyPict.bmp" For Binary Access Read As FN
  5. Get FN, , TStr
  6.  
To Save in TextFile, open text file and use:

Put FNDest, , TStr

REgards
Veena
Sep 22 '07 #3

P: 3
Thanks Veena.
Where r u assiging the value for TStr? When that Tsr gets populated?
Thanks in advance.


Hi,

Open the Image in "Binary File " Mode, Read using "Get" and save in TextFile using "Put"
Check this :

Expand|Select|Wrap|Line Numbers
  1. Dim TStr As String
  2. Dim FN As Long
  3. FN = FreeFile 
  4. Open "C:\MyPict.bmp" For Binary Access Read As FN
  5. Get FN, , TStr
  6.  
To Save in TextFile, open text file and use:

Put FNDest, , TStr

REgards
Veena
Sep 24 '07 #4

P: 1
You need to set the string to the length of the input binary file before doing the get, so the get knows how much you want.

dim lngInputLen as long
lngInputLen = LOF(FN)
TStr = String(lngInputLen, " ")
Get FN, , TStr
Jul 24 '12 #5

Post your reply

Sign in to post your reply or Sign up for a free account.