Fix data corruption with 24bit PNGs + safeguard against unsupported channel count