diff --git a/python/test_conversion.py b/python/test_conversion.py index 6091224a..d3637e75 100755 --- a/python/test_conversion.py +++ b/python/test_conversion.py @@ -110,5 +110,14 @@ class TestConversion(unittest.TestCase): self.run_unary([self.colour], band_eor, fmt = int_formats) + def test_bandjoin(self): + im2 = Vips.Image.bandjoin([self.colour, self.mono]) + + self.assertEqual(im2.bands, self.colour.bands + self.mono.bands) + v = im2.getpoint(10, 10) + self.assertAlmostEqualObjects(v, [2, 3, 4, 3]) + v = im2.getpoint(50, 50) + self.assertAlmostEqualObjects(v, [3, 5, 7, 5]) + if __name__ == '__main__': unittest.main() diff --git a/python/vips8/vips.py b/python/vips8/vips.py index b8070ad8..b9102674 100644 --- a/python/vips8/vips.py +++ b/python/vips8/vips.py @@ -517,6 +517,9 @@ def vips_exp(self): def vips_exp10(self): return self.math(Vips.OperationMath.EXP10) +def vips_bandjoin2(self, other): + return Vips.Image.bandjoin([self, other]) + # paste our methods into Vips.Image # class methods @@ -589,6 +592,7 @@ Vips.Image.log = vips_log Vips.Image.log10 = vips_log10 Vips.Image.exp = vips_exp Vips.Image.exp10 = vips_exp10 +Vips.Image.bandjoin2 = vips_bandjoin2 # operator overloads Vips.Image.__getattr__ = vips_image_getattr