Exemplo n.º 1
0
    def test_draw_with_rgb_output(self):
        source = 'test_src/original_udc.png'

        drawn = extract_shape(path=source,
                              black_background=False,
                              white_shape=False,
                              rgb_shape=True,
                              red=159,
                              green=36,
                              blue=110)

        expected = Image.open(source.replace('original', 'expected'))

        self.assertTrue(self.are_equals(drawn, expected))
Exemplo n.º 2
0
    def test_draw_with_black_background(self):
        source = 'test_src/original_spaceship.png'

        drawn = extract_shape(path=source,
                              black_background=True,
                              white_shape=False,
                              rgb_shape=False,
                              red=None,
                              green=None,
                              blue=None)

        expected = Image.open(source.replace('original', 'expected'))

        self.assertTrue(self.are_equals(drawn, expected))
Exemplo n.º 3
0
def main():
    mask_path, black_background, template_path, outpath, red, green, blue \
        = handle_arguments(sys.argv[1:])

    # Use Monoshape library to get the well format mask
    mask = extract_shape(mask_path, black_background, False, True, red, green,
                         blue)

    # Open the folder template to folstamp
    template_path = Image.open(template_path)
    template_path = template_path.convert("RGBA")

    # Stamp and save PNG
    stamped_folder = stamp(mask, template_path)
    stamped_folder.save(outpath, 'PNG')

    print(__file__)
    # Generate macOS iconset
    gen_iconset.main([outpath])

    print("[\033[92mOK\033[0m]: all generated!")