Updated writepng example.