Thumbnails and Zooming with GDI+ and C#
(Page 1 of 4 )
In the last part I gave you a bird’s eye view of what GDI+ is and showed you how to set up an application for using GDI+. However, without knowing more about the facilitator (i.e. GDI+), going forward would be counterproductive. Hence, in this part, along with different image manipulation techniques, the focus will be on the essentials of GDI+.
In the first section of this article, I will discuss GDI+ in brief, including the differences from its predecessor, that is GDI. The second section will focus on the manipulation techniques such as zooming and creating thumbnails. In the third and fourth sections I will extend the application created in the last part to include the techniques introduced in this discussion. That is the outline of this discussion.
More About GDI+
GDI+ essentially refers to the library that helps developers to interact with various devices such as monitors, printers, and others that have graphical capabilities without going into low-level details of these devices. The essence of GDI+ is that it can interact with peripherals such as monitors and present data in human readable form. From the point of view of a developer, it's a monumental task to interact directly with these devices.
This is where GDI+ comes into picture. It acts as a conduit and a translator for the data being passed between devices and applications. Even controlling the command line terminals comes under GDI+. It does everything from printing a "Hello World" program on the console to drawing lines, rectangles and so forth and printing a form. Pictorially it can be shown thus:

The next question that arises is how does GDI+ work? To make it crystal clear, let's look at an example of drawing a line. A line, in essence, is a sequence of pixels from a starting location (X0, Y0) to an ending location (Xn, Yn). To draw such a line the devices (the monitor in this case) need to know the device coordinates or physical coordinates.
However, instead of directly telling the device, the call is made to the drawLine() method of GDI+, and GDI+ draws the line from point A to point B in the memory, also known as video memory. GDI+ reads the point A and point B locations, converts them to a sequence of pixels, and tells the monitor to display the sequence of pixels. In short, GDI+ converts device independent calls to a device understandable form and vice versa.
So that’s an overview of how GDI+ works. Let's now move on to the topic of image manipulation.
Next: Image Manipulation: Thumbnail, Zooming and Saving >>
More C# Articles
More By A.P.Rajshekhar