diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a13fdc28..f423782e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## Unreleased ### Features -- Vips tile source and tiled file writer ([816](../../pull/816)) +- Vips tile source and tiled file writer ([816](../../pull/816), [827](../../pull/827), [830](../../pull/830)) ### Improvements - Handle file URLs with GDAL ([820](../../pull/820)) diff --git a/sources/vips/large_image_source_vips/__init__.py b/sources/vips/large_image_source_vips/__init__.py index 30fcd7b75..1bdd7a245 100644 --- a/sources/vips/large_image_source_vips/__init__.py +++ b/sources/vips/large_image_source_vips/__init__.py @@ -4,6 +4,7 @@ import os import threading import uuid +from pathlib import Path import cachetools import numpy @@ -445,8 +446,9 @@ def write(self, path, lossy=True, alpha=True, overwriteAllowed=True, vips_kwargs x = min(x, img.width) y = min(y, img.height) img = img.crop(x, y, w, h) - if vips_kwargs is not None: - img.write_to_file(path, **vips_kwargs) + pathIsTiff = Path(path).suffix.lower() in {'tif', 'tiff'} + if vips_kwargs is not None or not pathIsTiff: + img.write_to_file(path, **(vips_kwargs or {})) elif not lossy: img.write_to_file( path, tile_width=self.tileWidth, tile_height=self.tileHeight,