Commit c7836d32 authored by narugo1992's avatar narugo1992
Browse files

dev(narugo): add new img

parent c458cd53
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -21,6 +21,9 @@ jobs:
          - '3.9'
          - '3.10'
          - '3.11'
        exclude:
          - os: 'macos-latest'
            python-version: '3.7'

    steps:
      - name: Get system version for Linux
+8 −7
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ from imgutils.validate.truncate import _mock_load_truncated_images
INCHES_TO_PIXELS = 96


def _image_input_process(img) -> Tuple[Image.Image, str]:
def _image_input_process(img, autocensor: bool = True) -> Tuple[Image.Image, str]:
    if isinstance(img, tuple):
        img_file, label = img
        image = load_image(img_file, force_background=None)
@@ -25,6 +25,7 @@ def _image_input_process(img) -> Tuple[Image.Image, str]:
    image = grid_transparent(image)
    label = label.rstrip()

    if autocensor:
        detection = detect_censors(image)
        if detection:
            image = censor_areas(image, method='emoji', areas=[area for area, _, _ in detection])
@@ -35,7 +36,7 @@ def _image_input_process(img) -> Tuple[Image.Image, str]:

@_wrap_func_as_cli
@_mock_load_truncated_images(True)
def image_plot(*images, save_as: str, columns=2, keep_axis: bool = False, figsize=(6, 6)):
def image_plot(*images, save_as: str, columns=2, keep_axis: bool = False, figsize=(6, 6), autocensor: bool = True):
    plt.cla()
    plt.tight_layout()

@@ -46,7 +47,7 @@ def image_plot(*images, save_as: str, columns=2, keep_axis: bool = False, figsiz
    plt.subplots_adjust(wspace=0.2, hspace=0.15)
    for i, img in enumerate(images, start=0):
        xi, yi = i // columns, i % columns
        image, label = _image_input_process(img)
        image, label = _image_input_process(img, autocensor)
        if rows == 1 and columns == 1:
            ax = axs
        elif rows == 1:
+106 KiB
Loading image diff...
+71.3 KiB
Loading image diff...
+390 KiB
Loading image diff...
Loading