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.

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.