1
0
python-pydicom/pydicom-pr1908-fixpillow.patch
Dirk Mueller 1abc033a13 Accepting request 1141566 from home:bnavigator:branches:devel:languages:python
- Update to 2.4.4
  ## Changes
  * Removed support for Python 3.6 (EOL since December 2021)
  ## Enhancements
  * Added attribute alphabetic (#1634)
  * Added attribute json_key (#1648)
  * Added value validation for numerical VRs, add type validation
    for all validated VRs (#1414)
  * CLI commands now accept pydicom charset test files and CLI help
    shows Python Version (#1674)
  * Added support for Python 3.11 (#1658)
  * Added ISfloat to allow non-strict reading of existing files
    with float IS values (#1661)
  * Improved speed of creating and accessing highly nested
    structures (#1728, #1734)
  * Switched to a pyproject.toml build process (#1792)
  * Updated DICOM and UID dicts to DICOM 2023b (#1803)
  ## Fixes
  * Fixed length validation of DS values with maximum length
    without a leading zero (#1632)
  * Increased download speed with progress bar for test data
    (#1611)
  * Fixed crash due to invalid private creator (#1638)
  * Fixed extremely long BytesLengthException error messages
    (#1683)
  * In codify, ensure unique variable names for DICOM keywords
    repeated in sequences, and handle unicode characters correctly
    (#1670)
  * Fixed handling of some invalid values in to_json_dict() if
    suppress_invalid_tags is set to True (#1693)

OBS-URL: https://build.opensuse.org/request/show/1141566
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pydicom?expand=0&rev=28
2024-01-26 09:37:48 +00:00

24 lines
958 B
Diff

From 11f7bd260137a18496bdfd00ddb742ef0cf2d2fd Mon Sep 17 00:00:00 2001
From: scaramallion <scaramallion@users.noreply.github.com>
Date: Mon, 16 Oct 2023 10:35:46 +1100
Subject: [PATCH 1/4] Fix Pillow raising AttributeError due to Image.mode being
read-only
Index: pydicom-2.4.4/pydicom/pixel_data_handlers/pillow_handler.py
===================================================================
--- pydicom-2.4.4.orig/pydicom/pixel_data_handlers/pillow_handler.py
+++ pydicom-2.4.4/pydicom/pixel_data_handlers/pillow_handler.py
@@ -129,7 +129,11 @@ def _decompress_single_frame(
image.tile[0][2],
(color_mode, ''),
)]
- image.mode = color_mode
+ # Pillow 10.1+ made Image.mode read-only
+ if hasattr(image, "_mode"):
+ image._mode = color_mode
+ else:
+ image.mode = color_mode
image.rawmode = color_mode
return image