Skip to content

Commit

Permalink
Explicitly mark vips output as tiled
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed May 3, 2022
1 parent 01f9d4f commit 86b014e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sources/vips/large_image_source_vips/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,17 +449,18 @@ def write(self, path, lossy=True, alpha=True, overwriteAllowed=True, vips_kwargs
y = min(y, img.height)
img = img.crop(x, y, w, h)
pathIsTiff = Path(path).suffix.lower() in {'tif', 'tiff'}
pixels = img.width * img.height
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,
pyramid=True, bigtiff=True,
tile=True, pyramid=True, bigtiff=pixels >= 2 * 1024 ** 3,
region_shrink='nearest', compression='lzw', predictor='horizontal')
else:
img.write_to_file(
path, tile_width=self.tileWidth, tile_height=self.tileHeight,
pyramid=True, bigtiff=True,
tile=True, pyramid=True, bigtiff=pixels >= 2 * 1024 ** 3,
compression='jpeg', Q=90)

@property
Expand Down

0 comments on commit 86b014e

Please sign in to comment.