diff --git a/ChangeLog b/ChangeLog index c2d23e26..006e6cad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -41,7 +41,7 @@ - added VIPS_ROUND as well as VIPS_RINT - resize/reduce*/shrink*/affine now round output size to nearest rather than rounding down, thanks ioquatix -- better overlap support for google maps in dzsave +- better support for tile overlaps in google maps mode in dzsave 19/8/16 started 8.3.4 - better transparency handling in gifload, thanks diegocsandrim diff --git a/libvips/foreign/dzsave.c b/libvips/foreign/dzsave.c index 9c662d69..294253f9 100644 --- a/libvips/foreign/dzsave.c +++ b/libvips/foreign/dzsave.c @@ -438,6 +438,8 @@ vips_gsf_dir_new( VipsGsfDirectory *parent, const char *name ) (GsfOutfile *) parent->out, name, TRUE ); + g_assert( dir->out ); + parent->children = g_slist_prepend( parent->children, dir ); return( dir ); diff --git a/test/test_foreign.py b/test/test_foreign.py index 3cca53d9..61de9ce0 100755 --- a/test/test_foreign.py +++ b/test/test_foreign.py @@ -579,7 +579,7 @@ class TestForeign(unittest.TestCase): # test the overlap for equality self.colour.dzsave("test", suffix = ".png") - # tes horizontal overlap ... expect 256 step, overlap 1 + # test horizontal overlap ... expect 256 step, overlap 1 x = Vips.Image.new_from_file("test_files/10/0_0.png") self.assertEqual(x.width, 255) y = Vips.Image.new_from_file("test_files/10/1_0.png") @@ -626,6 +626,31 @@ class TestForeign(unittest.TestCase): shutil.rmtree("test") + # google layout with overlap ... verify that we clip correctly + # with overlap 192 tile size 256, we should step by 64 pixels each time + # so 3x3 tiles exactly + self.colour.crop(0, 0, 384, 384).dzsave("test2", layout = "google", + overlap = 192, depth = "one") + + # test bottom-right tile ... default is 256x256 tiles, overlap 0 + x = Vips.Image.new_from_file("test2/0/2/2.jpg") + self.assertEqual(x.width, 256) + self.assertEqual(x.height, 256) + self.assertFalse(os.path.exists("test2/0/3/3.jpg")) + + shutil.rmtree("test2") + + self.colour.crop(0, 0, 385, 385).dzsave("test3", layout = "google", + overlap = 192, depth = "one") + + # test bottom-right tile ... default is 256x256 tiles, overlap 0 + x = Vips.Image.new_from_file("test3/0/3/3.jpg") + self.assertEqual(x.width, 256) + self.assertEqual(x.height, 256) + self.assertFalse(os.path.exists("test3/0/4/4.jpg")) + + shutil.rmtree("test3") + # default zoomify layout self.colour.dzsave("test", layout = "zoomify")