This refactors getData to be more readable and extracts all the color conversion algorithms to their own functions. The resulting code was then cleaned up. This also introduces a flag `forceRGBoutput` to getData, that allows to always get the data as a `width * height * 3` bytes long RGB buffer