Fix pixel format bug in pixel manipulation