Fix bug with image dimensions. Make sure that we check the result of trying to write the png file and notify the user if it fails.