473,831 Members | 2,341 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Output Stream, ImageFormat.Jpe g);

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.Conten tType= "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 1399
base.Response.C learContent();
base.Response.C ontentType = "image/jpeg";
objBitmap.Save( Response.Output Stream, ImageFormat.Jpe g);
// Important to cancel page HTML rendering:
base.Response.E nd();

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

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

objBitmap.Save( Response.Output Stream, ImageFormat.Jpe g);

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.Conten tType= "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.co m

"Gav" <sp**@spam.co m> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Hi all,

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

objBitmap.Save( Response.Output Stream, ImageFormat.Jpe g);

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.Conten tType= "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.C learContent();
base.Response.C ontentType = "image/jpeg";
objBitmap.Save( Response.Output Stream, ImageFormat.Jpe g);
// Important to cancel page HTML rendering:
base.Response.E nd();

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

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

objBitmap.Save( Response.Output Stream, ImageFormat.Jpe g);

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.Conten tType= "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.C learContent();
base.Response.C ontentType = "image/jpeg";
objBitmap.Save( Response.Output Stream, ImageFormat.Jpe g);
// Important to cancel page HTML rendering:
base.Response.E nd();

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

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

objBitmap.Save( Response.Output Stream, ImageFormat.Jpe g);

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.Conten tType= "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
2347
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. 1. If the images are stored in the DB then, every an image is requested, it will need to be pulled out and a temp file created and then displayed? What is the best way to do this?
2
6726
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 on the screen (using the Graphics class), but not how to create an actual image with this feature. The key reason that I wanted to do this was graphics resources. You can have only so many transparent windows on a multiple monitor system...
11
5301
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 this handler gets the image from a database. Please check the various image formats. (The images are stored in a SQL database as Image type.) I post you a demo HTTP handler below. I guess, it's the ViewState which messes up (in Windows Forms I...
3
3097
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 displayed. Can anybody know this issue and help me to resolve this. In past i received the response saying that i should download the image first and then parse the actual response and modify the src attribute of the
0
1482
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 something is not right because of the way I am using Application::DoEvents() (ref: http://www.codinghorror.com/blog/archives/000159.html and http://www.codinghorror.com/blog/archives/000370.html ), along with the fact that I get a crash when I try...
0
2081
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 border/background effects. Rather than duplicate the entire chunk of CSS 3 times, I thought "Gee, I should only have to specify the 3 backgrounds (all the other placement directives would be identical). However I must not be correctly specifying the...
2
3100
by: wstsoi | last post by:
hi I have to read images from spreadsheet, is it possible to do with php?
1
2080
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 and the main stream approach appears to be a panel/groupBox containing a pictureBox, resizing that pictureBox and using the PictureBoxSizeMode.StretchImage property. I don't want that. What I want is some "real" zoom effect. So I continued my search...
4
1596
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", "~/ShowPicture.aspx?PictureID={0}") %>' The image is generated from an aspx page called “showPicture.aspx†using the following code behind:
1
5603
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 working fine. My aim is to double click the picture box and the desired image will be drawn at the mouse position. This works fine unless I scroll or minimise the form because the image isnt repainted after movement. I looked up drawing the image to...
0
9642
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10777
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10494
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10534
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10207
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5780
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3076
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.