class_docstr: Wrapper for the FI bitmap object.
class_docstr_tok: ["Wrapper","for","the","FI","bitmap","object","."]
code: def save_to_filename(self, filename=None):
      if filename is None:
          filename = self._filename
  
      ftype = self._ftype
      bitmap = self._bitmap
      fi_type = self._fi_type  # element type
  
      with self._fi as lib:
          # Check if can write
          if fi_type == FI_TYPES.FIT_BITMAP:
              can_write = lib.FreeImage_FIFSupportsExportBPP(
                  ftype, lib.FreeImage_GetBPP(bitmap)
              )
          else:
              can_write = lib.FreeImage_FIFSupportsExportType(
                  ftype, fi_type
              )
          if not can_write:
              raise TypeError(
                  "Cannot save image of this format to this file type"
              )
  
          # Save to file
          res = lib.FreeImage_Save(
              ftype, bitmap, efn(filename), self._flags
          )
          # Check
          if (
              res is None
          ):  # pragma: no cover, we do so many checks, this is rare
              raise RuntimeError(
                  f"Could not save file `{self._filename}`: {self._fi._get_error_message()}"
              )
  
imports: import os
  import sys
  import ctypes
  import threading
  import logging
  import numpy
  from ..core import get_remote_file, load_lib, Dict, resource_dirs, IS_PYPY, get_platform, InternetNotAllowedError, NeedDownloadError
label_desc: Use image node_id 3 for calling the FIBitmap obj's underlying member method code with example usage: obj.save_to_filename(filename) without return types