.. index:: 
  !Image.set Method
  
.. _id3_face_image_set_class_method:

===============================================================================
Image.set Method
===============================================================================

Module: :ref:`Image<id3_face_image_class>`

Definition
----------

Sets the Image object fields.

.. warning:: This function does not allocate any memory and is unsafe! The user must handle the pixels pointer carefully.


.. tab-set::

    .. tab-item:: C#
      :sync: C#

      .. code:: C#

        public static Image Set(int width, int height, PixelFormat pixelFormat, IntPtr pixels)

      **Parameters**

        .. line-block::

          ``width`` int
          :guilabel:`in` The width, in pixels, of the image.

          ``height`` int
          :guilabel:`in` The height, in pixels, of the image.

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

          ``pixels`` IntPtr
          :guilabel:`in` A pointer to the image pixels 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.


    .. tab-item:: C
      :sync: C

      .. code:: C

        int id3FaceImage_Set (
            ID3_FACE_IMAGE hImage, 
            int width, 
            int height, 
            id3FacePixelFormat ePixelFormat, 
            void * pixels)

      **Parameters**

        .. line-block::

          ``hImage`` :ref:`ID3_FACE_IMAGE<id3_face_image_class>`
          :guilabel:`in` Handle to the Image object.

          ``width`` int
          :guilabel:`in` The width, in pixels, of the image.

          ``height`` int
          :guilabel:`in` The height, in pixels, of the image.

          ``ePixelFormat`` :ref:`id3FacePixelFormat<id3_face_pixel_format_enum>`
          :guilabel:`in` The pixel format of the image.

          ``pixels`` void *
          :guilabel:`in` A pointer to the image pixels of the image.


      **Returns**

        .. line-block::

          ``int``
          An error code.
          See :ref:`id3FaceError<id3_face_face_error_enum>` file for the list of possible error codes.


