473,395 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 14570
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mullin Yu | last post by:
now, i want to create a Image object, which is a white rectangle with a specific size of area, and a black string or barcode will be on it. any api or sample code or ideas? thanks!
2
by: Bruno Rodrigues | last post by:
Hi, Can I save an image in the database, without saving it first in the hard disk? Thanks, Bruno Rodrigues.
1
by: Daniel | last post by:
I have looked everywhere on the web for an answer to this and the only thing I can find is converting the image format when the file is present on the local filesystem. What I want to do is use a...
2
by: UJ | last post by:
I have need to convert a text string (with formatting) to an image. This is so that I can resize the image to different sizes and the formatting stays exactly the same regardless of the size. I...
1
by: Trammel | last post by:
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...
5
by: Socrates | last post by:
I am interested in developing an online utility that will enable users to copy and past any image (or upload any image on the internet) to the online utility, which will then convert the image to...
4
by: WaterWalk | last post by:
Hello, I'm currently learning string manipulation. I'm curious about what is the favored way for string manipulation in C, expecially when strings contain non-ASCII characters. For example, if...
0
by: madumm | last post by:
Hi All; String newImagePath = "C:\temp\abc.bmp" File filePath = new File(newImagePath); Image watermarkImg = Toolkit.getDefaultToolkit().getImage(filePath.toURL()); Any how i want convert...
0
by: norseman | last post by:
Daniel de Sousa Barros wrote: ================================================ Click Start/settings/control panel/system/advanced/settings(in \ performance area)/advanced/change set System...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.