How to use the pyvips.type_find function in pyvips

To help you get started, we’ve selected a few pyvips examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github libvips / pyvips / tests / test_create.py View on Github external
    @pytest.mark.skipif(pyvips.type_find("VipsOperation", "perlin") == 0,
                        reason="no perlin, skipping test")
    def test_perlin(self):
        im = pyvips.Image.perlin(512, 512)
        assert im.width == 512
        assert im.height == 512
        assert im.bands == 1
        assert im.format == pyvips.BandFormat.FLOAT
github libvips / libvips / test / test-suite / test_create.py View on Github external
    @pytest.mark.skipif(pyvips.type_find("VipsOperation", "worley") == 0,
                        reason="no worley, skipping test")
    def test_worley(self):
        im = pyvips.Image.worley(512, 512)
        assert im.width == 512
        assert im.height == 512
        assert im.bands == 1
        assert im.format == pyvips.BandFormat.FLOAT
github libvips / libvips / test / test-suite / test_conversion.py View on Github external
    @pytest.mark.skipif(pyvips.type_find("VipsConversion", "composite") == 0,
                        reason="no composite support, skipping test")
    def test_composite(self):
        # 50% transparent image
        overlay = self.colour.bandjoin(128)
        base = self.colour + 100
        comp = base.composite(overlay, "over")

        assert_almost_equal_objects(comp(0, 0), [51.8, 52.8, 53.8, 255],
                                    threshold=0.1)
github libvips / libvips / test / test-suite / test_conversion.py View on Github external
    @pytest.mark.skipif(pyvips.type_find("VipsOperation", "smartcrop") == 0,
                        reason="no smartcrop, skipping test")
    def test_smartcrop(self):
        test = self.image.smartcrop(100, 100)
        assert test.width == 100
        assert test.height == 100
github libvips / pyvips / tests / helpers / helpers.py View on Github external
def have(name):
    return pyvips.type_find("VipsOperation", name) != 0
github libvips / pyvips / tests / test_conversion.py View on Github external
    @pytest.mark.skipif(pyvips.type_find("VipsOperation", "smartcrop") == 0,
                        reason="no smartcrop, skipping test")
    def test_smartcrop(self):
        test = self.image.smartcrop(100, 100)
        assert test.width == 100
        assert test.height == 100
github libvips / pyvips / tests / test_arithmetic.py View on Github external
def test_find_trim(self):
        if pyvips.type_find("VipsOperation", "find_trim") != 0:
            im = pyvips.Image.black(50, 60) + 100
            test = im.embed(10, 20, 200, 300, extend="white")

            for x in unsigned_formats + float_formats:
                a = test.cast(x)
                left, top, width, height = a.find_trim()

                assert left == 10
                assert top == 20
                assert width == 50
                assert height == 60

            test_rgb = test.bandjoin([test, test])
            left, top, width, height = test_rgb.find_trim(background=[255, 255,
                                                                      255])
            assert left == 10
github libvips / pyvips / tests / test_conversion.py View on Github external
    @pytest.mark.skipif(pyvips.type_find("VipsOperation", "gravity") == 0,
                        reason="no gravity in this vips, skipping test")
    def test_gravity(self):
        im = pyvips.Image.black(1, 1) + 255

        positions = [
            ['centre', 1, 1],
            ['north', 1, 0],
            ['south', 1, 2],
            ['east', 2, 1],
            ['west', 0, 1],
            ['north-east', 2, 0],
            ['south-east', 2, 2],
            ['south-west', 0, 2],
            ['north-west', 0, 0]
        ]
github libvips / libvips / test / test-suite / helpers / helpers.py View on Github external
def have(name):
    return pyvips.type_find("VipsOperation", name) != 0