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

Convert IMAGE object to STRING for manipulation?

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.