add tests for tiff pyr save region-shrink flag
we were testing the flag before, but not that the result was correct see https://github.com/libvips/libvips/issues/1875
This commit is contained in:
parent
85f3ac6d8f
commit
39899582d4
@ -374,10 +374,7 @@ class TestForeign:
|
||||
|
||||
self.file_loader("tiffload", TIF4_FILE, tiff4_valid)
|
||||
|
||||
if pyvips.at_least_libvips(8, 5):
|
||||
self.save_load_buffer("tiffsave_buffer",
|
||||
"tiffload_buffer",
|
||||
self.colour)
|
||||
self.save_load_buffer("tiffsave_buffer", "tiffload_buffer", self.colour)
|
||||
self.save_load("%s.tif", self.mono)
|
||||
self.save_load("%s.tif", self.colour)
|
||||
self.save_load("%s.tif", self.cmyk)
|
||||
@ -510,14 +507,14 @@ class TestForeign:
|
||||
assert a.height == b.height
|
||||
assert a.avg() == b.avg()
|
||||
|
||||
x = pyvips.Image.new_from_file(TIF_FILE)
|
||||
buf = x.tiffsave_buffer(tile=True, pyramid=True, region_shrink="mean")
|
||||
buf = x.tiffsave_buffer(tile=True, pyramid=True, region_shrink="mode")
|
||||
buf = x.tiffsave_buffer(tile=True, pyramid=True, region_shrink="median")
|
||||
buf = x.tiffsave_buffer(tile=True, pyramid=True, region_shrink="max")
|
||||
buf = x.tiffsave_buffer(tile=True, pyramid=True, region_shrink="min")
|
||||
buf = x.tiffsave_buffer(tile=True, pyramid=True,
|
||||
region_shrink="nearest")
|
||||
# just 0/255 in each band, shrink with mode and all pixels should be 0
|
||||
# or 255 in layer 1
|
||||
x = pyvips.Image.new_from_file(TIF_FILE) > 128
|
||||
for shrink in ["mode", "median", "max", "min"]:
|
||||
buf = x.tiffsave_buffer(pyramid=True, region_shrink=shrink)
|
||||
y = pyvips.Image.new_from_buffer(buf, "", page=1)
|
||||
z = y.hist_find(band=0)
|
||||
assert z(0, 0)[0] + z(255, 0)[0] == y.width * y.height
|
||||
|
||||
@skip_if_no("magickload")
|
||||
def test_magickload(self):
|
||||
|
Loading…
Reference in New Issue
Block a user