473,385 Members | 1,523 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,385 software developers and data experts.

Image transfer

Hi all,

Can anyone give me a brief description of what I need to do to
transfer an image from a client/server application using C#? When I
googled, I found that first I need to convert the image into a stream
and than tranfser it. Is that right? How I'm going to convert back the
stream to an image? Using deserialization? If possible point out in
steps what I need to do!

Thanks a lot in advanced,
Clayton

Feb 28 '07 #1
2 2918
Hello Clayton,
>Can anyone give me a brief description of what I need to do to
transfer an image from a client/server application using C#? When I
googled, I found that first I need to convert the image into a stream
and than tranfser it. Is that right? How I'm going to convert back the
stream to an image? Using deserialization? If possible point out in
steps what I need to do!
Well, it depends. "Convert an image into a stream" - that doesn't say a
lot. An image is a block of bytes, basically, and you can easily send
those bytes, one by one, through a network connection, put them back
together on the other side and get the same image.

In practice, you may need to encode the byte stream somehow, according to
the needs of the communications protocol you're using - base64 would be
one example of such an encoding. When decoding the byte stream on the
other side, you would then have to use the corresponding algorithm of
course.
Oliver Sturm
--
http://www.sturmnet.org/blog
Mar 4 '07 #2
If you want to transfer image you need to convert your image into filestream,
yes it is correct and code is as follows

FileStream f = new FileStream(@"c:\image.jpg", FileMode.Open);
You will need to import System.IO namcespace also. If you have image then
first save it to disk usaing Image.save("Path") function and then read it in
filestream.
and you can send this stream to server

Now on the recieving end you will regenerate the image from stream as follows

Bitmap img=new Bitmap(streamBoject);

so it is simple just pass the filestream to the constructor for bitmap

--
Mahesh A Deo, MCP
"Clayton" wrote:
Hi all,

Can anyone give me a brief description of what I need to do to
transfer an image from a client/server application using C#? When I
googled, I found that first I need to convert the image into a stream
and than tranfser it. Is that right? How I'm going to convert back the
stream to an image? Using deserialization? If possible point out in
steps what I need to do!

Thanks a lot in advanced,
Clayton

Mar 15 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Pierre Tremblay | last post by:
Hi! I am trying to display an image in my html document. The document contains the following line: <td class="Input"><img...
5
by: Kevin Vogler | last post by:
I have a subdirectory with it's own images folder. All the image paths in the pages in the sub directory are "image/image.jpg" When I Response.Redirect to a page in the subdirectory the images...
4
by: Marc Pelletier | last post by:
Hello, I have a class (TideClass) which creates a bitmap image as one of its functions. I want to create a page which has this image embedded amongst some text. I know that I have to stream the...
4
by: Simon Verona | last post by:
I'm using wia in a vb.net project to capture images from a scanner.. This works fine. However, I want to control the way that images are scanned - ie B+W, Greyscale and resolution etc, but can't...
19
by: **Developer** | last post by:
When I get the image from the file the file remains locked so the Delete fails with a "used by another process" So I tried using a clone and disposing the obtained image. But that didn't fix...
4
by: Nicolas | last post by:
Hello! I have a question: I have a database in MySql that has two fields (code and image). Now, I want to create a WebService that takes the image of the most current row (the code is the date...
24
by: Manuel | last post by:
Is it possible to embed an image, like a company logo in a CDOSYS generated message? If yes, I´ll apreciate some code sample. I´ve been able to format messages in html the way I like, but I...
23
by: Peter | last post by:
I have a problem with a page show_image.asp that returns a jpg image under Windows XP Pro SP2. The page sets content type as: Response.ContentType = "image/jpg" While this works perfectly fine...
2
by: studentofknowledge | last post by:
For some unknown reason ie is placing images I have in a div in a weird way. One image is overlapping another but this problem is not occuring in mozilla. I have looked at my code over and over again...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.