Question convert image to base64 string

amario26

New member
Joined
Jul 20, 2011
Messages
3
Programming Experience
1-3
Hi,

Sorry if you don't understand what I'm saying but quite an amateur an VB.NET.

I am trying to convert a TIFF image to a base 64 string.

I have seen so much code on the internet like the one below, but I don't understand it :(

I dont know what to change so it converts my image(s).

Does anyone know how to do it?

Any help would be appreciated. Also, if you can, please can you note what I need to change.

Also, I want the outcome (the bytes) as a variable that I can use outside this function. Know how to do that?

Many thanks,

Code:
VB.NET:
[COLOR=blue]Private[/COLOR] [COLOR=blue]Function[/COLOR] BytesToImage([COLOR=blue]ByVal[/COLOR] ImageBytes() [COLOR=blue]As[/COLOR] [COLOR=blue]Byte[/COLOR]) [COLOR=blue]As[/COLOR] Image
    [COLOR=blue]Dim[/COLOR] imgNew [COLOR=blue]As[/COLOR] Image
    [COLOR=blue]Dim[/COLOR] memImage [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] System.IO.MemoryStream(ImageBytes)
    imgNew = Image.FromStream(memImage)
    Return imgNew
[COLOR=blue]End[/COLOR] [COLOR=blue]Function[/COLOR]
 
Top Bottom