Added support for NChannelImage and ExtendToNChannel


Sorry for all the previous open/close pull requests. This is the only merge to look at.

Generally ``assert`` statements are good for debugging code. For committed code, I would prefer to have a proper Exception raised here.