code: def set_html5_canvas_format(self, fmt):
          
          fmt = fmt.lower()
          if fmt not in ('jpeg', 'png'):
              raise ValueError("Format must be one of {jpeg|png} not '%s'" % (
                  fmt))
  
          settings = self.get_settings()
          settings.set(html5_canvas_format=fmt)
docs: Sets the format used for rendering to the HTML5 canvas.
          'png' offers greater clarity, especially for small text, but
          does not have as good of performance as 'jpeg'.