image: Fix reading of PNG images with different number of channels.
image: Move helpers to respective modules.
image: Allow to read PNG from a C++ stream.