Allow image format to be set via options (png, jpeg, gif); make png the default format; documentation and minor code structure improvement.