function for outputting png added