G GaNdAlF89 Active Member Licensed User Longtime User Apr 17, 2013 #1 To print an image file, my printer needs it in binary format. How can I convert an image (saved in File.DirRootExternal) to binary? Thanks
To print an image file, my printer needs it in binary format. How can I convert an image (saved in File.DirRootExternal) to binary? Thanks
JTmartins Active Member Licensed User Longtime User Apr 18, 2013 #2 Can you explain better ? I got curious on your post. I mean, whatever image you have, it is already in binary format (0's and 1's). It may have a header with information about the image, depending on format, but you can be sure that inside the file you will find only 0's and 1's. José Upvote 0
Can you explain better ? I got curious on your post. I mean, whatever image you have, it is already in binary format (0's and 1's). It may have a header with information about the image, depending on format, but you can be sure that inside the file you will find only 0's and 1's. José
Erel B4X founder Staff member Licensed User Longtime User Apr 18, 2013 #3 Are you trying to read a file into an array of bytes? Code: Copy Sub ReadFile(Dir As String, FileName As String) As Byte() Dim out As OutputStream out.InitializeToBytesArray(100) 'size not really important File.Copy2(File.OpenInput(Dir, FileName), out) Return out.ToBytesArray End Sub Upvote 0
Are you trying to read a file into an array of bytes? Code: Copy Sub ReadFile(Dir As String, FileName As String) As Byte() Dim out As OutputStream out.InitializeToBytesArray(100) 'size not really important File.Copy2(File.OpenInput(Dir, FileName), out) Return out.ToBytesArray End Sub
G GaNdAlF89 Active Member Licensed User Longtime User Apr 18, 2013 #4 Thanks Erel, it works! Upvote 0