Search

Image vs Bitmap in C#

A lot of people get confused about when to use the Bitmap class and when to use the Image class in C#. All of our examples on this site tend to use the Bitmap class because it is, for the most part, the easier class to use when getting started.

The big difference between the Image class and the Bitmap class is that the Image class is not fully defined. It’s what is known as an “Abstract Base Class”. What this means is that you can not create an instance of an Image object. Try this:

var image = new Image(); // this is a syntax error and will not compile

You will get a syntax error. Now try this:

var bitmap = new Bitmap(); // this is good

The only time that you need to use an Image object is if you want to write multiple functions that take different kinds of Image objects and return them to the same calling code.

If all you want to do is edit images, play with pixels, and generate images then a Bitmap object is the easiest way to get started.

Categories

About Efundies

The goal of efundies.com is to provide the Internet with a collection of fun, free, electronics projects and advice.
Jason Bauer is an owner and programmer for Portforward.com. He's allergic to twitter and facebook, but you can find more of his articles in the Guides section.