Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

Commit

Permalink
Merge pull request #26 from davanstrien/master
Browse files Browse the repository at this point in the history
Add Kwarg to slice function to supress Pillow DecompressionBombWarning
  • Loading branch information
samdobson committed Sep 27, 2019
2 parents d4a9d73 + f085fc2 commit aee77a2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion image_slicer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ def validate_image_col_row(image , col , row):



def slice(filename, number_tiles=None, col=None, row=None, save=True):
def slice(filename, number_tiles=None, col=None, row=None,
save=True, DecompressionBombWarning=True):
"""
Split an image into a specified number of tiles.
Expand All @@ -141,10 +142,14 @@ def slice(filename, number_tiles=None, col=None, row=None, save=True):
Kwargs:
save (bool): Whether or not to save tiles to disk.
DecompressionBombWarning (bool): Whether to suppress Pillow DecompressionBombWarning
Returns:
Tuple of :class:`Tile` instances.
"""
if DecompressionBombWarning is False:
Image.MAX_IMAGE_PIXELS = None

im = Image.open(filename)
im_w, im_h = im.size

Expand Down

0 comments on commit aee77a2

Please sign in to comment.