.. index:: 
  !Image.crop Method
  
.. _id3_face_image_crop_class_method:

===============================================================================
Image.crop Method
===============================================================================

Module: :ref:`Image<id3_face_image_class>`

Definition
----------

Crop a rectangular region of interest in the image according to the given bounds.


.. tab-set::

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

      .. code:: Python

        crop(self, left: int, top: int, width: int, height: int) -> Image

      **Parameters**

        .. line-block::

          ``left`` int
          :guilabel:`in` Left bound of the crop to extract.

          ``top`` int
          :guilabel:`in` Top bound of the crop to extract.

          ``width`` int
          :guilabel:`in` Width of the crop to extract.

          ``height`` int
          :guilabel:`in` Height of the crop to extract.


      **Returns**

        .. line-block::

          :ref:`Image<id3_face_image_class>`
          The extracted region of interest.

      **Exceptions**

        .. line-block::

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


    .. tab-item:: Dart
      :sync: Dart

      .. code:: Dart

        Image crop(int left, int top, int width, int height)

      **Parameters**

        .. line-block::

          ``left`` int
          :guilabel:`in` Left bound of the crop to extract.

          ``top`` int
          :guilabel:`in` Top bound of the crop to extract.

          ``width`` int
          :guilabel:`in` Width of the crop to extract.

          ``height`` int
          :guilabel:`in` Height of the crop to extract.


      **Returns**

        .. line-block::

          :ref:`Image<id3_face_image_class>`
          The extracted region of interest.

      **Exceptions**

        .. line-block::

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


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

      .. code:: C#

        public Image Crop(int left, int top, int width, int height)

      **Parameters**

        .. line-block::

          ``left`` int
          :guilabel:`in` Left bound of the crop to extract.

          ``top`` int
          :guilabel:`in` Top bound of the crop to extract.

          ``width`` int
          :guilabel:`in` Width of the crop to extract.

          ``height`` int
          :guilabel:`in` Height of the crop to extract.


      **Returns**

        .. line-block::

          :ref:`Image<id3_face_image_class>`
          The extracted region of interest.

      **Exceptions**

        .. line-block::

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


    .. tab-item:: Java
      :sync: Java

      .. code:: Java

        public Image crop(int left, int top, int width, int height) throws FaceException

      **Parameters**

        .. line-block::

          ``left`` int
          :guilabel:`in` Left bound of the crop to extract.

          ``top`` int
          :guilabel:`in` Top bound of the crop to extract.

          ``width`` int
          :guilabel:`in` Width of the crop to extract.

          ``height`` int
          :guilabel:`in` Height of the crop to extract.


      **Returns**

        .. line-block::

          :ref:`Image<id3_face_image_class>`
          The extracted region of interest.

      **Exceptions**

        .. line-block::

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


    .. tab-item:: Swift
      :sync: Swift

      .. code:: Swift

        public func crop(left: Int32, top: Int32, width: Int32, height: Int32) throws -> Image

      **Parameters**

        .. line-block::

          ``left`` Int32
          :guilabel:`in` Left bound of the crop to extract.

          ``top`` Int32
          :guilabel:`in` Top bound of the crop to extract.

          ``width`` Int32
          :guilabel:`in` Width of the crop to extract.

          ``height`` Int32
          :guilabel:`in` Height of the crop to extract.


      **Returns**

        .. line-block::

          :ref:`Image<id3_face_image_class>`
          The extracted region of interest.

      **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_Crop (
            ID3_FACE_IMAGE hImage, 
            int left, 
            int top, 
            int width, 
            int height, 
            ID3_FACE_IMAGE hImageCrop)

      **Parameters**

        .. line-block::

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

          ``left`` int
          :guilabel:`in` Left bound of the crop to extract.

          ``top`` int
          :guilabel:`in` Top bound of the crop to extract.

          ``width`` int
          :guilabel:`in` Width of the crop to extract.

          ``height`` int
          :guilabel:`in` Height of the crop to extract.

          ``hImageCrop`` :ref:`ID3_FACE_IMAGE<id3_face_image_class>`
          :guilabel:`out` The extracted region of interest.


      **Returns**

        .. line-block::

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


