docs: def dump(self, dest_pattern="{id}.jpg", override=True, max_size=None, bits=8, contrast=None, gamma=None,
               colormap=None, inverse=None):
          """
          Download the image with optional image modifications.
  
          Parameters
          ----------
          dest_pattern : str, optional
              Destination path for the downloaded image. "{X}" patterns are replaced by the value of X attribute
              if it exists.
          override : bool, optional
              True if a file with same name can be overrided by the new file.
          max_size : int, tuple, optional
              Maximum size (width or height) of returned image. None to get original size.
          bits : int (8,16,32) or str ("max"), optional
              Bit depth (bit per channel) of returned image. "max" returns the original image bit depth
          contrast : float, optional
              Optional contrast applied on returned image.
          gamma : float, optional
              Optional gamma applied on returned image.
          colormap : int, optional
              Cytomine identifier of a colormap to apply on returned image.
          inverse : bool, optional
              True to inverse color mapping, False otherwise.
  
          Returns
          -------
          downloaded : bool
              True if everything happens correctly, False otherwise. As a side effect, object attribute "filename"
              is filled with downloaded file path.
          """
          if self.id is None:
              raise ValueError("Cannot dump an annotation with no ID.")
  
          pattern = re.compile("{(.*?)}")
          dest_pattern = re.sub(pattern, lambda m: str(getattr(self, str(m.group(0))[1:-1], "_")), dest_pattern)
  
          destination = os.path.dirname(dest_pattern)
          filename, extension = os.path.splitext(os.path.basename(dest_pattern))
          extension = extension[1:]
  
          if extension not in ("jpg", "png", "tif", "tiff"):
              extension = "jpg"
  
          if not os.path.exists(destination):
              os.makedirs(destination)
  
          if isinstance(max_size, tuple) or max_size is None:
              max_size = max(self.width, self.height)
  
          parameters = {
              "maxSize": max_size,
              "contrast": contrast,
              "gamma": gamma,
              "colormap": colormap,
              "inverse": inverse,
              "bits": bits
          }
  
          file_path = os.path.join(destination, "{}.{}".format(filename, extension))
  
          url = self.preview[:self.preview.index("?")]
          url = url.replace(".png", ".{}".format(extension))
          result = Cytomine.get_instance().download_file(url, file_path, override, parameters)
          if result:
              self.filename = file_path
          return result