473,395 Members | 1,568 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.

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 1370
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...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.