473,385 Members | 1,465 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.

images using graphics class

Gav
Hi all,

I'm trying to create a bitmap and then use outputstream to display the
picture:

objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);

It doesn't give me any errors although the web page comes up with lots of
characters in the page instead of a picture... I then added:

Response.ContentType= "image/jpeg";

I put this before the outputstream but it didn't make any difference, does
anybody know what I could be doing wrong?

Regards
Gav
Jul 21 '05 #1
4 1369
base.Response.ClearContent();
base.Response.ContentType = "image/jpeg";
objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);
// Important to cancel page HTML rendering:
base.Response.End();

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Gav" <sp**@spam.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Hi all,

I'm trying to create a bitmap and then use outputstream to display the
picture:

objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);

It doesn't give me any errors although the web page comes up with lots of
characters in the page instead of a picture... I then added:

Response.ContentType= "image/jpeg";

I put this before the outputstream but it didn't make any difference, does
anybody know what I could be doing wrong?

Regards
Gav

Jul 21 '05 #2
Gav,

Is your page buffered? I seem to remember that if it is not, then the
headers would be already written, and you could not change the content type.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Gav" <sp**@spam.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Hi all,

I'm trying to create a bitmap and then use outputstream to display the
picture:

objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);

It doesn't give me any errors although the web page comes up with lots of
characters in the page instead of a picture... I then added:

Response.ContentType= "image/jpeg";

I put this before the outputstream but it didn't make any difference, does
anybody know what I could be doing wrong?

Regards
Gav

Jul 21 '05 #3
Gav
Thanks for the help but I never could get this to work. I'm not sure why. I
think it may have something to do with the fact I'm trying to do it inside a
web user control (I'm not sure). But anyway I got around it by saving it to
a file and simply displaying the file.

Thanks again
Gav

"Dennis Myrén" <de****@oslokb.no> wrote in message
news:7J****************@news4.e.nsc.no...
base.Response.ClearContent();
base.Response.ContentType = "image/jpeg";
objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);
// Important to cancel page HTML rendering:
base.Response.End();

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Gav" <sp**@spam.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Hi all,

I'm trying to create a bitmap and then use outputstream to display the
picture:

objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);

It doesn't give me any errors although the web page comes up with lots of
characters in the page instead of a picture... I then added:

Response.ContentType= "image/jpeg";

I put this before the outputstream but it didn't make any difference,
does
anybody know what I could be doing wrong?

Regards
Gav


Jul 21 '05 #4
Gav
Thanks for the help but I never could get this to work. I'm not sure why. I
think it may have something to do with the fact I'm trying to do it inside a
web user control (I'm not sure). But anyway I got around it by saving it to
a file and simply displaying the file.

Thanks again
Gav

"Dennis Myrén" <de****@oslokb.no> wrote in message
news:7J****************@news4.e.nsc.no...
base.Response.ClearContent();
base.Response.ContentType = "image/jpeg";
objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);
// Important to cancel page HTML rendering:
base.Response.End();

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Gav" <sp**@spam.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Hi all,

I'm trying to create a bitmap and then use outputstream to display the
picture:

objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);

It doesn't give me any errors although the web page comes up with lots of
characters in the page instead of a picture... I then added:

Response.ContentType= "image/jpeg";

I put this before the outputstream but it didn't make any difference,
does
anybody know what I could be doing wrong?

Regards
Gav


Jul 21 '05 #5

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

Similar topics

7
by: Vinay | last post by:
Hi All: I have a small application that stores images either in the database or as files (depending on the user preference). I'm in the process of providing a web interface to this application....
2
by: Duke | last post by:
I've been trying to find a way to combine two images such that they are "blended" i.e. that the top image is a semi-transparent overlay on the bottom image. Many code examples show how to do this...
11
by: Detlef Hüttenbach | last post by:
Whereas loading tiffs and pngs from file into an Image WebControl work, the images aren't shown when loaded from streams: In a WebForm, the image's property "ImageUrl" is set to a handler, and...
3
by: Hitesh | last post by:
Hi, I am getting the response from another Website by using the HttpHandler in my current site. I am getting the page but all the images on that page are not appearing only placeholder are...
0
by: Marcus Kwok | last post by:
I have written a class (Windows Form) in Managed C++ that accepts an array of image filenames and will display them sequentially. All images will be the same size. I got it to work, but I know...
0
by: Jeb Hunter | last post by:
Well, how can I describe this succinctly? I have a page with DIVs that us background images to produce a border effect. It works perfectly well, but I want to make up (for now) 3 different...
2
by: wstsoi | last post by:
hi I have to read images from spreadsheet, is it possible to do with php?
1
by: Amnu | last post by:
Hi there, I've been told to write a custom control using C#.NET ( 2.0 ). This control should be able to display images and give access to zoom functionality. I've visited numerous How-To pages...
4
by: =?Utf-8?B?SmFtZXMgUGFnZQ==?= | last post by:
Hi all I have a SQL database where images are stored in a varBinary field. I can display those images within a image control on a page by using the following: ImageUrl='<%# Eval("PictureID",...
1
by: martinsmith160 | last post by:
Hi all I am trying to create a level builder tool for a final year project and im having some problems drawing. I have placed a picture box within a panel so i can scroll around the image which is...
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
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...
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:
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...
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.