.. index:: 
  !Image.fromNumpy Method
  
.. _id3_face_image_from_numpy_class_method:

===============================================================================
Image.fromNumpy Method
===============================================================================

Module: :ref:`Image<id3_face_image_class>`

Definition
----------

Creates an Image from the specified data buffer. Supported pixel formats are grayscale formats, BGR and RGB 24bits, and BGRA. For integers format, input datatype must be UINT8.


.. tab-set::

    .. tab-item:: Python
      :sync: Python

      .. code:: Python

        @staticmethod
        from_numpy(data: bytearray, pixel_format: PixelFormat) -> Image

      **Parameters**

        .. line-block::

          ``data`` bytearray
          :guilabel:`in` A numpy array containing the image data.

          ``pixel_format`` :ref:`PixelFormat<id3_face_pixel_format_enum>`
          :guilabel:`in` The pixel format of the image.


      **Returns**

        .. line-block::

          :ref:`Image<id3_face_image_class>`
          The newly created image.

      **Exceptions**

        .. line-block::

          :ref:`FaceException<id3_face_face_exception>`
          An error has occurred during Face Library execution.



