Skip to content

Commit

Permalink
Make it easier to write a non-tiff vips source
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Apr 18, 2022
1 parent 51c647b commit 11cb9e7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sources/vips/large_image_source_vips/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import threading
import uuid
from pathlib import Path

import cachetools
import numpy
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 11cb9e7

Please sign in to comment.