very hacky function to output an image