简体   繁体   English

使用C#创建3通道位图?

[英]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. 加载使用C#创建的bmp时,会引发一个例外,即图像必须为3通道。

I'm new to the image manipulation world, how would I make a standard .bmp file created using C# a 3 channel image? 我是图像处理领域的新手,我该如何使用C#创建3通道图像的标准.bmp文件?

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

Right now you're using a four-channel pixel format . 现在,您正在使用四通道像素格式 PixelFormat.Format32bppArgb has a red, green, blue and alpha channel. PixelFormat.Format32bppArgb具有红色,绿色,蓝色和Alpha通道。 I would suggest trying a pixel format which has three channels, such as PixelFormat.Format24bppRgb . 我建议尝试使用具有三个通道的像素格式,例如PixelFormat.Format24bppRgb

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM