.. index:: 
  !PortraitProcessor.removeBackground Method
  
.. _id3_face_portrait_processor_remove_background_class_method:

===============================================================================
PortraitProcessor.removeBackground Method
===============================================================================

Module: :ref:`PortraitProcessor<id3_face_portrait_processor_class>`

Definition
----------

Removes the background on the specified portrait image.

.. important:: This method requires the ``FaceBackgroundSegmenter1A`` model to be loaded.


.. tab-set::

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

      .. code:: Python

        remove_background(self, image: Image, red: int, green: int, blue: int) -> None

      **Parameters**

        .. line-block::

          ``image`` :ref:`Image<id3_face_image_class>`
          :guilabel:`in` The portrait image.

          ``red`` int
          :guilabel:`in` Green channel of the background color. Must be a value from 0 to 255.

          ``green`` int
          :guilabel:`in` Red channel of the background color. Must be a value from 0 to 255.

          ``blue`` int
          :guilabel:`in` Blue channel of the background color. Must be a value from 0 to 255.


      **Exceptions**

        .. line-block::

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


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

      .. code:: Dart

        void removeBackground(Image image, int red, int green, int blue)

      **Parameters**

        .. line-block::

          ``image`` :ref:`Image<id3_face_image_class>`
          :guilabel:`in` The portrait image.

          ``red`` int
          :guilabel:`in` Green channel of the background color. Must be a value from 0 to 255.

          ``green`` int
          :guilabel:`in` Red channel of the background color. Must be a value from 0 to 255.

          ``blue`` int
          :guilabel:`in` Blue channel of the background color. Must be a value from 0 to 255.


      **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 void RemoveBackground(Image image, int red, int green, int blue)

      **Parameters**

        .. line-block::

          ``image`` :ref:`Image<id3_face_image_class>`
          :guilabel:`in` The portrait image.

          ``red`` int
          :guilabel:`in` Green channel of the background color. Must be a value from 0 to 255.

          ``green`` int
          :guilabel:`in` Red channel of the background color. Must be a value from 0 to 255.

          ``blue`` int
          :guilabel:`in` Blue channel of the background color. Must be a value from 0 to 255.


      **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 void removeBackground(Image image, int red, int green, int blue) throws FaceException

      **Parameters**

        .. line-block::

          ``image`` :ref:`Image<id3_face_image_class>`
          :guilabel:`in` The portrait image.

          ``red`` int
          :guilabel:`in` Green channel of the background color. Must be a value from 0 to 255.

          ``green`` int
          :guilabel:`in` Red channel of the background color. Must be a value from 0 to 255.

          ``blue`` int
          :guilabel:`in` Blue channel of the background color. Must be a value from 0 to 255.


      **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 removeBackground(image: Image, red: Int32, green: Int32, blue: Int32) throws

      **Parameters**

        .. line-block::

          ``image`` :ref:`Image<id3_face_image_class>`
          :guilabel:`in` The portrait image.

          ``red`` Int32
          :guilabel:`in` Green channel of the background color. Must be a value from 0 to 255.

          ``green`` Int32
          :guilabel:`in` Red channel of the background color. Must be a value from 0 to 255.

          ``blue`` Int32
          :guilabel:`in` Blue channel of the background color. Must be a value from 0 to 255.


      **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 id3FacePortraitProcessor_RemoveBackground (
            ID3_FACE_PORTRAIT_PROCESSOR hPortraitProcessor, 
            ID3_FACE_IMAGE hImage, 
            int red, 
            int green, 
            int blue)

      **Parameters**

        .. line-block::

          ``hPortraitProcessor`` :ref:`ID3_FACE_PORTRAIT_PROCESSOR<id3_face_portrait_processor_class>`
          :guilabel:`in` Handle to the PortraitProcessor object.

          ``hImage`` :ref:`ID3_FACE_IMAGE<id3_face_image_class>`
          :guilabel:`in` The portrait image.

          ``red`` int
          :guilabel:`in` Green channel of the background color. Must be a value from 0 to 255.

          ``green`` int
          :guilabel:`in` Red channel of the background color. Must be a value from 0 to 255.

          ``blue`` int
          :guilabel:`in` Blue channel of the background color. Must be a value from 0 to 255.


      **Returns**

        .. line-block::

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


