code: def pil_save(self, filename, compression=6, fformat=None,
                   thumbnail_name=None, thumbnail_size=None):
          
          # PIL does not support compression option.
          del compression
  
          if self.is_empty():
              raise IOError("Cannot save an empty image")
  
          if isinstance(filename, (str, six.text_type)):
              ensure_dir(filename)
  
          fformat = fformat or os.path.splitext(filename)[1][1:4]
          fformat = check_image_format(fformat)
  
          params = {}
  
          if fformat == 'png':
              # Take care of GeoImage.tags (if any).
              params['pnginfo'] = self._pngmeta()
  
          # JPEG images does not support transparency
          if fformat == 'jpeg' and not self.fill_value:
              self.fill_value = [0, 0, 0, 0]
              logger.debug("No fill_value provided, setting it to 0.")
  
          img = self.pil_image()
          img.save(filename, fformat, **params)
  
          if thumbnail_name is not None and thumbnail_size is not None:
              img.thumbnail(thumbnail_size, Pil.ANTIALIAS)
              img.save(thumbnail_name, fformat, **params)
docs: Save the image to the given *filename* using PIL. For now, the
          compression level [0-9] is ignored, due to PIL's lack of support. See
          also :meth:`save`.