473,322 Members | 1,806 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,322 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 14556
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.