Ask a Question related to ASP.NET General, Design and Development.
-
Chris Jones #1
.png doesn't work for dynamically generated images, but .jpeg and .gif does
I am creating a web page that dynamically generates an
image, which is placed in an Image control. Everything
works fine for .gif and .jpeg files. I would prefer
using .png format, but that doesn't seem to work.
Here's how it's setup.
The Image control has URL property "image.aspx".
The Page_Load method of image.aspx contains the code
{
//generate image
Bitmap bitmap = ...
//Return the image
Response.ContentType = "image/png";
bitmap.Save(Response.OutputStream,ImageFormat.Png) ;
}
If ContentType is "image/jpeg" and bitmap.Save's 2nd
parameter is ImageFormat.Jpeg, everything works fine.
Same for ContentType = "image/gif" and bitmap.Save's 2nd
argument is ImageFormat.Gif. When the code appears as
above, the Image control displays the dreaded "X" icon
indicating that the image can't be found.
Note that I can use a different version of the Save
method for the bitmap to write the .png image to a file.
I can then open the file successfully in IE.
I am using VS.NET 2002 and .NET framework 1.0.
Thanks for your help.
Chris Jones
Chris Jones Guest
-
removing dynamically generated MCs from timeline
I'm working on a Flash/XML photo album that loads external images via XML. I've created thumbnails that load dynamically and now I want the... -
Dynamically Generated Forms
My company has a database-driven system of web forms, each of which consists of many questions in various layouts (2-column radio, 1 column... -
Using textfields that are dynamically generated
Hi, I have a question about using textfields that I'm generating dynamically. I am generating textfields depending on the number of records in... -
Dynamically Generated Columns needs to hidden
I need to hide one column which I bind to my datagrid using a dataset. I know I can take the column out of my SQL for my dataset, but I cannot I... -
Dynamically generated png images
I am creating a web page that dynamically generates an image, which is placed in an Image control. Everything works fine for .gif and .jpeg files....



Reply With Quote

