made raw2png more functional