Lossless Image Converting in C#
(Page 1 of 4 )
Images can be easily categorized into love-hate relationships when it comes to actually working with them from the programmer’s point of view. Nowadays images are a must in almost every Windows application and we tend to run into images quite often. In this series we are going to get into the details of image resizing and conversion.Throughout this two-part article we are going to create a seemingly simple, yet powerful, Lightweight Image Manipulation application. As the title suggests, we'll do this in the C# language using the .NET environment and relying on GDI+ and Graphics. At the end you will find the source code of this project in its entirety available for you to download.
However, I truly think that following along won't be a hard task if you have a bit of programming experience and especially if you are familiar with the syntax of C#. Thus, during this tutorial I am going to assume that the reader knows the syntax well enough - at least on the intermediate level - so we won't begin with the Hello Word example.
We should be advancing quite steadily and at a relatively fast pace, so hopefully nobody gets bored to tears. Before we approach a situation we clarify in plain English what we want to accomplish and then we formulate an algorithm that accomplishes this. After this, each subroutine will get thoroughly explained as well as the reason for using the required methods.
Since this is a two-part series, in order to maintain the simplicity of the tutorial and to make things easy to follow, we will also split our application into two parts. First we will cover lossless conversion and then the second part will contain the resizing process along with color quantization. Color quantization must be discussed in order to understand the theory beyond the GIF extension and how to preserve high quality.
Finally at the end of the second part we will attach the source code for the entire project so you can download it and have fun with it. I have used Visual Studio 2005 but it should work with any Visual C# IDE in the .NET environment. A partial source code will also be attached at the end of this first part, particularly the conversion section.
All of this being said, since you're anxiously waiting to begin... here we go now.
Next: First Things First >>
More C# Articles
More By Barzan "Tony" Antal