test pyvips bandjoin

This commit is contained in:
John Cupitt 2014-09-24 21:57:56 +01:00
parent fd9300750d
commit b402bb173f
2 changed files with 13 additions and 0 deletions

View File

@ -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()

View File

@ -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