Chapter 16. Dynamic Images


In this chapter

Getting Started with Dynamic Images in ASP.NET

Creating Banners Dynamically with Tiled Backgrounds

Image Processing

This chapter teaches you how to create dynamic images that you can use in your ASP.NET applications. Graphics and imaging are areas in which I have found most developers to be somewhat lacking. I am not really sure why this is ”probably because most developers end up creating database applications or applications with complicated user interfaces. When I started off programming in the early 1980s, the user interface elements that are so common today did not exist. So, that meant you had to draw your own objects.

With that said, though, you still need to ask yourself why you would want to create dynamic images for your ASP.NET applications. After all, you already have the modern user interface objects. And there is DHTML, which offers many of the graphical techniques that you might desire . But DHTML is not the panacea it is claimed to be. Different browsers respond in different ways, and even different browser versions respond in different ways. Sometimes, a basically good piece of DHTML code will not work at all. I was sitting next to a friend of mine at the Author's Summit that Microsoft invited us to in the summer of 2000. When they started talking about the GDI.NET stuff and what you could do with it in an ASP.NET, my friend turned to me and said, "Why would I need that? DHTML does everything they are talking about." Well, the fact is that DHTML doesn't do everything that GDI.NET does, and GDI.NET doesn't rely on a browser version to work correctly.

So, what types of things can you do with dynamic images? There are some marvelous answers to that question. You can create charts and graphs to look some sort of data set that new users might want to see. For example, if you are tracking a certain stock, you can easily represent it with a graphical chart that is generated on demand. And this generated chart reflects the current information about that particular stock, such as its current price, its PE, its high and low. This gives users a much more pleasant experience than just seeing a bunch of numbers in some sort of a table. Users would almost rather see something represented graphically as opposed to a text-based table.

In addition to applications that depict charts and graphs, I'm sure you can envision an entire raft of scientific applications. These might show astronomical data in the form of charts; they might show star charts for the evening; they might show weather maps; or they might show some sort of 3-D engineering model. There is almost no end to what types of scientific and engineering applications you can create if you can generate dynamic images from a Web-based application.

Some of you at this moment are saying, "Well, I have been doing this for years . I have an ASP-based application that generates dynamic images." And I could say the same thing, because I have an application on that enables users to create certificates online. The certificates are generated using some COM objects on the server end that take user input and create the resulting certificate image. I also have an interesting interactive application on the same Web site that enables users to create graffiti-like images. These images then are dynamically rendered on the server side, saved to disk, and indexed in a database.

The entire application is fairly complicated, but it illustrates that, even without ASP.NET and GDI.NET, you can create dynamic images in a server-side ASP application. But it took me a lot of work to do both of those applications I just described. I had to do all the imaging myself , had to write the COM objects, test and debug them, and then work out a lot of details along the way. ASP.NET, with its GDI.NET components , makes the entire process much easier. And that is what this chapter talks about: how to use these ASP.NET features to quickly and effectively create applications with dynamic images.


Special Edition Using ASP. NET
Special Edition Using ASP.Net
ISBN: 0789725606
EAN: 2147483647
Year: 2002
Pages: 233 © 2008-2017.
If you may any questions please contact us: