469,658 Members | 1,674 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,658 developers. It's quick & easy.

Convert IMAGE object to STRING for manipulation?

Hi, I have a vb.net program made to grab screenshots and then store them in
image objects.
The image is displayed in a pictureBox atm but I want to store the data in a
String only.

(Without saving to a file on HDD, then loading it as binary)

Does anyone know how to convert an image into a string & have any pointers
to information on how the image would look when in the string (Like bit
patterns, etc)?

--
Trammel is a member of DWC (http://dwc.no-ip.org)
(Please reply to group only)
Nov 21 '05 #1
5 14275
Hi:

I use the ToBase64String function to convert the image stored in the
database to string;

System.Convert.ToBase64String(CType(dr(i), Byte()))

Hope this help
JCVoon

Trammel wrote:
Hi, I have a vb.net program made to grab screenshots and then store them in
image objects.
The image is displayed in a pictureBox atm but I want to store the data in a
String only.

(Without saving to a file on HDD, then loading it as binary)

Does anyone know how to convert an image into a string & have any pointers
to information on how the image would look when in the string (Like bit
patterns, etc)?

--
Trammel is a member of DWC (http://dwc.no-ip.org)
(Please reply to group only)


Nov 21 '05 #2
Code:
imgStr = System.Convert.ToBase64String(CType(img, Byte()))

Returns error:
E:\...\ScreenCapture.vb(88): Value of type 'System.Drawing.Image' cannot be
converted to '1-dimensional array of Byte'.

"jcvoon" <jc*******@yahoo.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi:

I use the ToBase64String function to convert the image stored in the
database to string;

System.Convert.ToBase64String(CType(dr(i), Byte()))

Trammel wrote:
Hi, I have a vb.net program made to grab screenshots and then store them in image objects.
The image is displayed in a pictureBox atm but I want to store the data in a String only.

(Without saving to a file on HDD, then loading it as binary)

Does anyone know how to convert an image into a string & have any pointers to information on how the image would look when in the string (Like bit
patterns, etc)?

Nov 21 '05 #3
Code:
imgStr = System.Convert.ToBase64String(CType(img, Byte()))

Returns error:
E:\...\ScreenCapture.vb(88): Value of type 'System.Drawing.Image' cannot be
converted to '1-dimensional array of Byte'.

"jcvoon" <jc*******@yahoo.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi:

I use the ToBase64String function to convert the image stored in the
database to string;

System.Convert.ToBase64String(CType(dr(i), Byte()))

Trammel wrote:
Hi, I have a vb.net program made to grab screenshots and then store them in image objects.
The image is displayed in a pictureBox atm but I want to store the data in a String only.

(Without saving to a file on HDD, then loading it as binary)

Does anyone know how to convert an image into a string & have any pointers to information on how the image would look when in the string (Like bit
patterns, etc)?

Nov 21 '05 #4
Hi:

you need to convert the image to byte array

Dim abyt As Byte()
Dim ms As New IO.MemoryStream
Dim bmp As New Bitmap("yourbitmap.bmp")

bmp.Save(ms, Imaging.ImageFormat.Bmp)

abyt = ms.ToArray()
E:\...\ScreenCapture.vb(88): Value of type 'System.Drawing.Image' cannot be
converted to '1-dimensional array of Byte'.


Nov 21 '05 #5
Hi:

you need to convert the image to byte array

Dim abyt As Byte()
Dim ms As New IO.MemoryStream
Dim bmp As New Bitmap("yourbitmap.bmp")

bmp.Save(ms, Imaging.ImageFormat.Bmp)

abyt = ms.ToArray()
E:\...\ScreenCapture.vb(88): Value of type 'System.Drawing.Image' cannot be
converted to '1-dimensional array of Byte'.


Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Bruno Rodrigues | last post: by
2 posts views Thread by UJ | last post: by
5 posts views Thread by Socrates | last post: by
4 posts views Thread by WaterWalk | last post: by
reply views Thread by norseman | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.