added png writing for mean