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)
|
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.mono)
|
||||||
self.save_load("%s.tif", self.colour)
|
self.save_load("%s.tif", self.colour)
|
||||||
self.save_load("%s.tif", self.cmyk)
|
self.save_load("%s.tif", self.cmyk)
|
||||||
@ -510,14 +507,14 @@ class TestForeign:
|
|||||||
assert a.height == b.height
|
assert a.height == b.height
|
||||||
assert a.avg() == b.avg()
|
assert a.avg() == b.avg()
|
||||||
|
|
||||||
x = pyvips.Image.new_from_file(TIF_FILE)
|
# just 0/255 in each band, shrink with mode and all pixels should be 0
|
||||||
buf = x.tiffsave_buffer(tile=True, pyramid=True, region_shrink="mean")
|
# or 255 in layer 1
|
||||||
buf = x.tiffsave_buffer(tile=True, pyramid=True, region_shrink="mode")
|
x = pyvips.Image.new_from_file(TIF_FILE) > 128
|
||||||
buf = x.tiffsave_buffer(tile=True, pyramid=True, region_shrink="median")
|
for shrink in ["mode", "median", "max", "min"]:
|
||||||
buf = x.tiffsave_buffer(tile=True, pyramid=True, region_shrink="max")
|
buf = x.tiffsave_buffer(pyramid=True, region_shrink=shrink)
|
||||||
buf = x.tiffsave_buffer(tile=True, pyramid=True, region_shrink="min")
|
y = pyvips.Image.new_from_buffer(buf, "", page=1)
|
||||||
buf = x.tiffsave_buffer(tile=True, pyramid=True,
|
z = y.hist_find(band=0)
|
||||||
region_shrink="nearest")
|
assert z(0, 0)[0] + z(255, 0)[0] == y.width * y.height
|
||||||
|
|
||||||
@skip_if_no("magickload")
|
@skip_if_no("magickload")
|
||||||
def test_magickload(self):
|
def test_magickload(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user