Get Image from embedded resource
-
I am using the following code to get an image from a file.
Using stream As New FileStream(sImageFilename, FileMode.Open, FileAccess.Read)
Dim img As Image = Image.FromStream(stream)End Using
Now what I would like to do instead is get the Image from my Resource file. I think I need to use MemoryStream but I am not sure how to use it. Any help is greatly appreciated.
-
I am using the following code to get an image from a file.
Using stream As New FileStream(sImageFilename, FileMode.Open, FileAccess.Read)
Dim img As Image = Image.FromStream(stream)End Using
Now what I would like to do instead is get the Image from my Resource file. I think I need to use MemoryStream but I am not sure how to use it. Any help is greatly appreciated.
So it is embedded in my.resources? Okay, you could extract the image (
My.Computer.FileSystem.WriteAllBytes(PathToExtract, My.Resources.ImageA, False)
) Then, what you can do is get the image and set it in a picturebox etc.
PictureBox1.Image = Image.FromFile(FileLocation)
-
So it is embedded in my.resources? Okay, you could extract the image (
My.Computer.FileSystem.WriteAllBytes(PathToExtract, My.Resources.ImageA, False)
) Then, what you can do is get the image and set it in a picturebox etc.
PictureBox1.Image = Image.FromFile(FileLocation)