NullReference
NullReference

Reputation: 4484

Create a 3 channel Bitmap with C#?

I'm creating a bunch of random images for testing and I'm using a third party tool to load the images and output a video. When it loads the bmps create using C# it's throwing an exception that the images need to be 3 channel.

I'm new to the image manipulation world, how would I make a standard .bmp file created using C# a 3 channel image?

  //bitmap
   Bitmap bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb);

Upvotes: 1

Views: 968

Answers (1)

cbr
cbr

Reputation: 13662

Right now you're using a four-channel pixel format. PixelFormat.Format32bppArgb has a red, green, blue and alpha channel. I would suggest trying a pixel format which has three channels, such as PixelFormat.Format24bppRgb.

Upvotes: 2

Related Questions