public CombineChannel(params UnmanagedImage[] channels)
{
if (channels == null)
throw new ArgumentNullException("channels");
if (channels.Length < 2)
throw new ArgumentException("There must be at least two channels to be combined.", "channels");
this.channels = channels;
this.baseWidth = channels[0].Width;
this.baseHeight = channels[0].Height;
foreach (var c in channels)
if (c.Width != baseWidth || c.Height != baseHeight)
throw new ArgumentException("All images must have the same dimensions.", "channels");
formatTranslations[PixelFormat.Format64bppArgb] = PixelFormat.Format64bppArgb;
formatTranslations[PixelFormat.Format48bppRgb] = PixelFormat.Format48bppRgb;
formatTranslations[PixelFormat.Format32bppRgb] = PixelFormat.Format32bppRgb;
formatTranslations[PixelFormat.Format32bppArgb] = PixelFormat.Format32bppArgb;
formatTranslations[PixelFormat.Format24bppRgb] = PixelFormat.Format24bppRgb;
}