          # Signal that this process has finished
          if completion_queue is not None:
              completion_queue.put(1)
  
      def patch_image(self, predicted):
          """ Patch the image """
          logger.trace("Patching image: '%s'", predicted["filename"])
          frame_size = (predicted["image"].shape[1], predicted["image"].shape[0])
          new_image, background = self.get_new_image(predicted, frame_size)
          patched_face = self.post_warp_adjustments(background, new_image)
          patched_face = self.scale_image(patched_face)
 
</s> remove         new_image, background = self.get_new_image(predicted, frame_size)
        patched_face = self.post_warp_adjustments(background, new_image)
        patched_face = self.scale_image(patched_face)
 </s> add         new_image, background = self._get_new_image(predicted, frame_size)
        patched_face = self._post_warp_adjustments(background, new_image)
        patched_face = self._scale_image(patched_face) </s> remove         # Signal that this process has finished
        if completion_queue is not None:
            completion_queue.put(1)
 </s> add  </s> remove         patched_face = np.rint(
            patched_face,
            out=np.empty(patched_face.shape, dtype="uint8"),
            casting='unsafe'
        )
        if self.writer_pre_encode is not None:
            patched_face = self.writer_pre_encode(patched_face)
 </s> add         patched_face = np.rint(patched_face,
                               out=np.empty(patched_face.shape, dtype="uint8"),
                               casting='unsafe')
        if self._writer_pre_encode is not None:
            patched_face = self._writer_pre_encode(patched_face) </s> remove     def get_new_image(self, predicted, frame_size):
        """ Get the new face from the predictor and apply box manipulations """
 </s> add     def _get_new_image(self, predicted, frame_size):
        """ Get the new face from the predictor and apply pre-warp manipulations.

        Applies any requested adjustments to the raw output of the Faceswap model
        before transforming the image into the target frame.

        Parameters
        ----------
        predicted: dict
            The output from :class:`scripts.convert.Predictor`.
        frame_size: tuple
            The (`width`, `height`) of the final frame in pixels

        Returns
        -------
        placeholder:  :class: `numpy.ndarray`
            The original frame with the swapped faces patched onto it
        background:  :class: `numpy.ndarray`
            The original frame
        """ </s> remove     def save(self, completion_event):
        """ Save the converted images """
 </s> add     def _save(self, completion_event):
        """ Save the converted images.

        Puts the selected writer into a background thread and feeds it from the output of the
        patch queue.

        Parameters
        ----------
        completion_event: :class:`event.Event`
            An even that this process triggers when it has finished saving
        """
    def _patch_image(self, predicted):
        """ Patch a swapped face onto a frame.

        Run selected adjustments and swap the faces in a frame.

        Parameters
        ----------
        predicted: dict
            The output from :class:`scripts.convert.Predictor`.

        Returns
        -------
        :class: `numpy.ndarray` or pre-encoded image output
            The final frame ready for writing by a :mod:`plugins.convert.writer` plugin.
            Frame is either an array, or the pre-encoded output from the writer's pre-encode
            function (if it has one)

        """
          # Signal that this process has finished
          if completion_queue is not None:
              completion_queue.put(1)
  
    def _patch_image(self, predicted):
        """ Patch a swapped face onto a frame.

        Run selected adjustments and swap the faces in a frame.

        Parameters
        ----------
        predicted: dict
            The output from :class:`scripts.convert.Predictor`.

        Returns
        -------
        :class: `numpy.ndarray` or pre-encoded image output
            The final frame ready for writing by a :mod:`plugins.convert.writer` plugin.
            Frame is either an array, or the pre-encoded output from the writer's pre-encode
            function (if it has one)

        """
    def _patch_image(self, predicted):
        """ Patch a swapped face onto a frame.

        Run selected adjustments and swap the faces in a frame.

        Parameters
        ----------
        predicted: dict
            The output from :class:`scripts.convert.Predictor`.

        Returns
        -------
        :class: `numpy.ndarray` or pre-encoded image output
            The final frame ready for writing by a :mod:`plugins.convert.writer` plugin.
            Frame is either an array, or the pre-encoded output from the writer's pre-encode
            function (if it has one)

        """
          logger.trace("Patching image: '%s'", predicted["filename"])
          frame_size = (predicted["image"].shape[1], predicted["image"].shape[0])
          new_image, background = self.get_new_image(predicted, frame_size)
          patched_face = self.post_warp_adjustments(background, new_image)
          patched_face = self.scale_image(patched_face)
keep keep keep keep replace replace keep keep keep keep keep
 Smart Masks to Convert (#957)

- scripts.convert - Use Smart Masks for Convert
    * Make on-the-fly conversion an explicit option

- Move BlurMask to lib.faces_detect

- tools.preview - Fix for smart masks
    * Subclass from tk.Tk
    * Options to lib.gui.control_helper
    *variable cleanup

- lib.logger - Demote more tensorflow deprecation messages

- Documentation:
    * lib.faces_detect.BlurMask
    * plugins.convert.mask
    * lib.convert
    * scripts.convert
    * scripts.fsmedia
    * tools.preview 
lib/convert.py