Use num_channels instead of gStuff->planes

One describes the document you're creating, the other the document you
have. If you have alpha channels but don't use them, this will cause
problems.

Found this bug while using SuperPNG to update the website...about
SuperPNG. Eating your own dog food is good.