clean up detecting the color type and bit_depth