Library tutorials & articles
Creating Images on the Fly with ASP.NET
- Introduction
- Drawing the graphics
Introduction
Before the advent of the .Net framework, creating images on the fly for a web
browser was a tedious task. Now, thanks to the .Net framework, creating images
on the fly is a simple task. This article will provide the reader with the fundamentals
necessary to start developing dynamic images with the .Net framework.
Creating dynamic images with the .Net framework is a four-step process. First,
set the content-type of the aspx file to an image type. Second, get an instance
of the Graphics object from a Bitmap. Third, draw on the Graphics object. Four,
save the Bitmap to an output stream.
The default content-type value for an aspx file is "text/html".
If we want to output an image, say an GIF, we need to set the content-type to
"image/gif". We simply add the following to the top of
our aspx page.
<%@ Page ContentType = "image/gif"%>
Related articles
Related discussion
-
sharepoint calendar web part with events from sql table
by tukubapi2207 (1 replies)
-
Using FedEx Web Service to Calculcate Shipping Cost
by bhora123 (4 replies)
-
Very Urgent regarding deleting the images from a folder
by rameshbandi (2 replies)
-
Dynamically Generating PDFs in .NET
by nike12 (10 replies)
-
New style of Javascript used in extenders.
by mittalpa (0 replies)
Related podcasts
-
StackOverflow uses ASP.NET MVC - Jeff Atwood and his technical team
Scott chats with Jeff Atwood of CodingHorror.com and most recently, StackOverflow.com. Jeff and Joel Spolsky and their technical team have created a new class of application using ASP.NET MVC. What works, what doesn't, and how did it all go down?
Excellent work.
You can skip this and just d/l ImageIN. Its an amazing free multi layer composition object which allows you to do many things... (http://www.cyberbob.com)
I am Also intrested in this idia!
Mosly dealing with online desing, submited to my e-mail.
I am sure it's dealing with Java Script or ASP i have some Links to a example of what i am looking for:
http://www.logocrazy.com/businesscards/logocards/logocards3.asp
http://209.209.50.113/magneticsigns/logosigns3.asp
Hi I am trying to create an online design system for business cards. the user selects the template with the design already made from the database and it allows you to enter your title name address, company ect to the card, trouble i am having is how i would i go about doing this, am good with db and asp any ideas would be great, have had a look at .net system.drawing does anyone think this would solve my problem is there properties to draw the text that the user wants to change or how would i re-assemmble the card with the new details and inbed it all into the one image, looking for any ideas or websites that could help me thanx
Lea
Lea or Farouk,
Did you find a solution for the online design? I am looking for the same, willing to pay for advice.
Thanks,
Dan
magnetmagic@yahoo.com
Can yuo please tell me what technology or code you used for handling business card design system. I would really appreciate your help
I are trying to do something very similar please
Farouk
Hi,
I'm using similar code to create a floorplan on the fly with database input.
I experience great difficulties to create a GIF file with non-ditchered colors and transparent background.
Anybody knows how to tackle this one ?
I found an article about re-coloring GIF images for transparent and non-ditchered colors at msdn, but this is for existing images and it's bloody complicated. Anybody knows a simple solution when creating GIF files from scratch ?
Stefaan
I'm not sure if this will help you, but I am doing some pretty complex client side drawing with SVG. It's XML & it's scriptable (javascript). Images can be generated client & server side. If someone can do this, then for sure you can create business cards. http://www.adobe.com/svg/demos/main.html
Hi I am trying to create an online design system for business cards. the user selects the template with the design already made from the database and it allows you to enter your title name address, company ect to the card, trouble i am having is how i would i go about doing this, am good with db and asp any ideas would be great, have had a look at .net system.drawing does anyone think this would solve my problem is there properties to draw the text that the user wants to change or how would i re-assemmble the card with the new details and inbed it all into the one image, looking for any ideas or websites that could help me thanx
Lea
Dear Craig,
I've an Windows Form custom control (an analog gauge control) to which I want to add the functionality of returning the drawn gauge image as bytes. I wanted to create a Bitmap image from the Graphics object. Unfortunately, I learnt that the Bitmap() constructor that took in a Graphics object doesn't actually create a representation of the image drawn on the Graphics object. And I am stuck.
I want to know a couple of things:
1.
I have a fully drawn image on a Graphics object. I want to save this into a Bitmap object. I don't have the liberty of creating a new Graphics object (the Graphics property of PaintEventArgs is read-only) and that might rule out the Graphics.FromImage(bitmap) approach.
2.
Also, I want to use this control on my ASP.Net code-behind class for generating an image of itself that would be streamed to the browser.
Say, I would add a method, GetImageAsBytes(), that would return a byte array of the image of the control.
I would write this image using
Response.ContentType = "image/gif";
Response.BinaryWrite(objGauge.GetImageAsBytes());
Response.End();
Would this approach work? What's the Pros & Cons of using a Windows Forms control on an ASP page? Would I be able to get a Graphic context at all (the code sure didn't throw up any errors).
Ideas?
Regards,
Vyas
This thread is for discussions of Creating Images on the Fly with ASP.NET.