Commit 318d27f8 authored by narugo1992's avatar narugo1992
Browse files

dev(narugo): update words

parent e554d6b8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -18,8 +18,8 @@ if __name__ == '__main__':

    image_plot(
        (image, 'origin'),
        (censor_img, 'censor_img'),
        (censor_areas(image, 'star', areas), 'star_censored'),
        (censor_img, 'star.png'),
        (censor_areas(image, 'star', areas), 'censored'),
        columns=2,
        figsize=(8, 6),
    )
+0 −411

File deleted.

Preview size limit exceeded, changes collapsed.

+27 −0
Original line number Diff line number Diff line
@@ -237,6 +237,33 @@ class ImageBasedCensor(BaseCensor):

        :return: The censored image.
        :rtype: Image.Image

        Examples::
            >>> from PIL import Image
            >>> from imgutils.operate import censor_areas
            >>>
            >>> origin = Image.open('genshin_post.jpg')
            >>> areas = [  # areas to censor
            >>>     (967, 143, 1084, 261),
            >>>     (246, 208, 331, 287),
            >>>     (662, 466, 705, 514),
            >>>     (479, 283, 523, 326)
            >>> ]
            >>>
            >>> # register the star image
            >>> register_censor_method('star', ImageBasedCensor, images=['star.png'])
            >>>
            >>> # default
            >>> censored = censor_areas(image, 'star', areas)

            .. image:: censor_image.plot.py.svg
                :align: center

            .. note::
                It is important to note that when using :class:`ImageBasedCensor` to censor an image,
                you need to manually register the image used for censoring
                using the :func:`register_censor_method` function.

        """
        x0, y0, x1, y1 = area
        ratio, idx, scale, r_fx, r_fy = self._find_censor(area, ratio_threshold)