Skip to content

Commit

Permalink
Merge pull request #890 from girder/lazier-import
Browse files Browse the repository at this point in the history
Be lazier on some imports.
  • Loading branch information
manthey authored Jul 22, 2022
2 parents 333cce8 + d5e7fe6 commit 11e9844
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion large_image/tilesource/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1311,8 +1311,9 @@ def _outputTile(self, tile, tileEncoding, x, y, z, pilImageAllowed=False,
if getattr(tile, 'fp', None) and self._pilFormatMatches(tile):
tile.fp.seek(0)
return tile.fp.read()
return _encodeImageBinary(
result = _encodeImageBinary(
tile, self.encoding, self.jpegQuality, self.jpegSubsampling, self.tiffCompression)
return result

def _getAssociatedImage(self, imageKey):
"""
Expand Down
4 changes: 2 additions & 2 deletions large_image/tilesource/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,8 +477,6 @@ def getPaletteColors(value):
above.
:returns: a numpy array of RGBA value on the scale of [0-255].
"""
import palettable

palette = None
if isinstance(value, (tuple, list)):
palette = value
Expand All @@ -489,6 +487,8 @@ def getPaletteColors(value):
except ValueError:
pass
if palette is None:
import palettable

try:
palette = attrgetter(str(value))(palettable).hex_colors
except AttributeError:
Expand Down

0 comments on commit 11e9844

Please sign in to comment.