class_docstr: Wrapper for the FI bitmap object.
class_docstr_tok: ["Wrapper","for","the","FI","bitmap","object","."]
code: def allocate(self, array):
      # Prepare array
      assert isinstance(array, numpy.ndarray)
      shape = array.shape
      dtype = array.dtype
  
      # Get shape and channel info
      r, c = shape[:2]
      if len(shape) == 2:
          n_channels = 1
      elif len(shape) == 3:
          n_channels = shape[2]
      else:
          n_channels = shape[0]
  
      # Get fi_type
      try:
          fi_type = FI_TYPES.fi_types[(dtype.type, n_channels)]
          self._fi_type = fi_type
      except KeyError:
          raise ValueError(
              "Cannot write arrays of given type and shape."
          )
  
      # Allocate bitmap
      with self._fi as lib:
          bpp = 8 * dtype.itemsize * n_channels
          bitmap = lib.FreeImage_AllocateT(fi_type, c, r, bpp, 0, 0, 0)
          bitmap = ctypes.c_void_p(bitmap)
  
          # Check and store
          if not bitmap:  # pragma: no cover
              raise RuntimeError(
                  "Could not allocate bitmap for storage: %s"
                  % self._fi._get_error_message()
              )
          self._set_bitmap(bitmap, (lib.FreeImage_Unload, bitmap))
  
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 1 for calling the FIBitmap obj's underlying member method code with example usage: obj.allocate(array) without return types