Image vs Bitmap in C#

Thumbnail image of Jason Bauer
Jason Bauer
December 29, 2015 (Last Updated: ) | Reading Time: About 1 minute

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.

Comments

avatar

David Jordan - 2016-03-20 16:21:09

reply

neet stuff leaned a hole lot il be back

Leave a reply

Thank you! Your comment has been successfully submitted. It will be approved as soon as possible.

More from Efundies