Skip to content

Commit a166aea

Browse files
authored
Disable PILs image size limit. (#1154)
* Diable PILs image size limit. * Update changelog.
1 parent 2acfb48 commit a166aea

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

webknossos/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ For upgrade instructions, please check the respective _Breaking Changes_ section
2121
- Added options `--layer-name` and `--mag` for compress command of the CLI. [#1141](https://github.com/scalableminds/webknossos-libs/pull/1141)
2222
- Added options `--chunk-shape` and `--chunks-per-shard` for convert command of the CLI. [#1150](https://github.com/scalableminds/webknossos-libs/pull/1150)
2323
- The `from_images` method of the `Dataset` supports directories and single files as `input_path` now. [#1152](https://github.com/scalableminds/webknossos-libs/pull/1152)
24+
- The number of pixel limit for JPG conversion is disabled now. [#1154](https://github.com/scalableminds/webknossos-libs/pull/1154)
2425
- Added option `--batch-size` to the convert command of the CLI. [#1158](https://github.com/scalableminds/webknossos-libs/pull/1158)
2526

2627
### Fixed

webknossos/webknossos/dataset/_utils/pims_images.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,11 @@ def _ensure_correct_bioformats_usage(
311311
+ "(use_bioformats is False)."
312312
)
313313

314+
def _disable_pil_image_size_limit(self) -> None:
315+
from PIL import Image
316+
317+
Image.MAX_IMAGE_PIXELS = None
318+
314319
def _try_open_pims_images(
315320
self, original_images: Union[str, List[str]], exceptions: List[Exception]
316321
) -> Optional[pims.FramesSequence]:
@@ -377,6 +382,8 @@ def strategy_2() -> Optional[pims.FramesSequence]:
377382
else:
378383
return None
379384

385+
self._disable_pil_image_size_limit()
386+
380387
for strategy in [strategy_0, strategy_1, strategy_2]:
381388
try:
382389
images_context_manager = strategy()

0 commit comments

Comments
 (0)