.. index:: 
  !DocumentImage.set Method
  
.. _id3_document_document_image_set_class_method:

===============================================================================
DocumentImage.set Method
===============================================================================

Module: :ref:`DocumentImage<id3_document_document_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 DocumentImage 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_document_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:`DocumentImage<id3_document_document_image_class>`
          The newly created document image.

      **Exceptions**

        .. line-block::

          :ref:`DocumentException<id3_document_document_exception>`
          An error has occurred during Document Library execution.


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

      .. code:: C

        int id3DocumentImage_Set (
            ID3_DOCUMENT_IMAGE hDocumentImage, 
            int width, 
            int height, 
            id3DocumentPixelFormat ePixelFormat, 
            void * pixels)

      **Parameters**

        .. line-block::

          ``hDocumentImage`` :ref:`ID3_DOCUMENT_IMAGE<id3_document_document_image_class>`
          :guilabel:`in` Handle to the DocumentImage 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:`id3DocumentPixelFormat<id3_document_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:`id3DocumentError<id3_document_document_error_enum>` file for the list of possible error codes.


