imageio 2.37.3__tar.gz → 2.37.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. {imageio-2.37.3 → imageio-2.37.4/ImageIO.egg-info}/PKG-INFO +2 -3
  2. {imageio-2.37.3 → imageio-2.37.4}/ImageIO.egg-info/requires.txt +0 -1
  3. {imageio-2.37.3/ImageIO.egg-info → imageio-2.37.4}/PKG-INFO +2 -3
  4. {imageio-2.37.3 → imageio-2.37.4}/imageio/core/fetching.py +1 -1
  5. {imageio-2.37.3 → imageio-2.37.4}/imageio/core/legacy_plugin_wrapper.py +1 -1
  6. {imageio-2.37.3 → imageio-2.37.4}/imageio/core/request.py +11 -6
  7. {imageio-2.37.3 → imageio-2.37.4}/imageio/core/util.py +2 -2
  8. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/_bsdf.py +1 -1
  9. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/_freeimage.py +2 -2
  10. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/_swf.py +2 -2
  11. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/bsdf.py +1 -1
  12. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/pillow.py +9 -6
  13. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/pillow_legacy.py +9 -5
  14. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/pillowmulti.py +5 -5
  15. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/pyav.py +3 -3
  16. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/tifffile_v3.py +17 -1
  17. {imageio-2.37.3 → imageio-2.37.4}/pyproject.toml +2 -3
  18. {imageio-2.37.3 → imageio-2.37.4}/tests/test_freeimage.py +24 -23
  19. {imageio-2.37.3 → imageio-2.37.4}/tests/test_tifffile_v3.py +6 -1
  20. {imageio-2.37.3 → imageio-2.37.4}/CONTRIBUTORS.txt +0 -0
  21. {imageio-2.37.3 → imageio-2.37.4}/ImageIO.egg-info/SOURCES.txt +0 -0
  22. {imageio-2.37.3 → imageio-2.37.4}/ImageIO.egg-info/dependency_links.txt +0 -0
  23. {imageio-2.37.3 → imageio-2.37.4}/ImageIO.egg-info/entry_points.txt +0 -0
  24. {imageio-2.37.3 → imageio-2.37.4}/ImageIO.egg-info/not-zip-safe +0 -0
  25. {imageio-2.37.3 → imageio-2.37.4}/ImageIO.egg-info/top_level.txt +0 -0
  26. {imageio-2.37.3 → imageio-2.37.4}/LICENSE +0 -0
  27. {imageio-2.37.3 → imageio-2.37.4}/MANIFEST.in +0 -0
  28. {imageio-2.37.3 → imageio-2.37.4}/README.md +0 -0
  29. {imageio-2.37.3 → imageio-2.37.4}/docs/Makefile +0 -0
  30. {imageio-2.37.3 → imageio-2.37.4}/docs/_static/imageio_logo.png +0 -0
  31. {imageio-2.37.3 → imageio-2.37.4}/docs/_templates/better_class.rst +0 -0
  32. {imageio-2.37.3 → imageio-2.37.4}/docs/_templates/formats.rst.template +0 -0
  33. {imageio-2.37.3 → imageio-2.37.4}/docs/_templates/plugin.rst +0 -0
  34. {imageio-2.37.3 → imageio-2.37.4}/docs/conf.py +0 -0
  35. {imageio-2.37.3 → imageio-2.37.4}/docs/development/index.rst +0 -0
  36. {imageio-2.37.3 → imageio-2.37.4}/docs/development/plugins.rst +0 -0
  37. {imageio-2.37.3 → imageio-2.37.4}/docs/examples.rst +0 -0
  38. {imageio-2.37.3 → imageio-2.37.4}/docs/formats/formats_by_plugin.rst +0 -0
  39. {imageio-2.37.3 → imageio-2.37.4}/docs/formats/index.rst +0 -0
  40. {imageio-2.37.3 → imageio-2.37.4}/docs/formats/video_formats.rst +0 -0
  41. {imageio-2.37.3 → imageio-2.37.4}/docs/imageio_ext.py +0 -0
  42. {imageio-2.37.3 → imageio-2.37.4}/docs/index.rst +0 -0
  43. {imageio-2.37.3 → imageio-2.37.4}/docs/make.bat +0 -0
  44. {imageio-2.37.3 → imageio-2.37.4}/docs/reference/core_v3.rst +0 -0
  45. {imageio-2.37.3 → imageio-2.37.4}/docs/reference/index.rst +0 -0
  46. {imageio-2.37.3 → imageio-2.37.4}/docs/reference/userapi.rst +0 -0
  47. {imageio-2.37.3 → imageio-2.37.4}/docs/user_guide/cmdlinescripts.rst +0 -0
  48. {imageio-2.37.3 → imageio-2.37.4}/docs/user_guide/drop27.rst +0 -0
  49. {imageio-2.37.3 → imageio-2.37.4}/docs/user_guide/envvariables.rst +0 -0
  50. {imageio-2.37.3 → imageio-2.37.4}/docs/user_guide/freezing.rst +0 -0
  51. {imageio-2.37.3 → imageio-2.37.4}/docs/user_guide/index.rst +0 -0
  52. {imageio-2.37.3 → imageio-2.37.4}/docs/user_guide/installation.rst +0 -0
  53. {imageio-2.37.3 → imageio-2.37.4}/docs/user_guide/overview.rst +0 -0
  54. {imageio-2.37.3 → imageio-2.37.4}/docs/user_guide/requests.rst +0 -0
  55. {imageio-2.37.3 → imageio-2.37.4}/docs/user_guide/scipy.rst +0 -0
  56. {imageio-2.37.3 → imageio-2.37.4}/docs/user_guide/standardimages.rst +0 -0
  57. {imageio-2.37.3 → imageio-2.37.4}/imageio/__init__.py +0 -0
  58. {imageio-2.37.3 → imageio-2.37.4}/imageio/__main__.py +0 -0
  59. {imageio-2.37.3 → imageio-2.37.4}/imageio/config/__init__.py +0 -0
  60. {imageio-2.37.3 → imageio-2.37.4}/imageio/config/extensions.py +0 -0
  61. {imageio-2.37.3 → imageio-2.37.4}/imageio/config/extensions.pyi +0 -0
  62. {imageio-2.37.3 → imageio-2.37.4}/imageio/config/plugins.py +0 -0
  63. {imageio-2.37.3 → imageio-2.37.4}/imageio/config/plugins.pyi +0 -0
  64. {imageio-2.37.3 → imageio-2.37.4}/imageio/core/__init__.py +0 -0
  65. {imageio-2.37.3 → imageio-2.37.4}/imageio/core/findlib.py +0 -0
  66. {imageio-2.37.3 → imageio-2.37.4}/imageio/core/format.py +0 -0
  67. {imageio-2.37.3 → imageio-2.37.4}/imageio/core/format.pyi +0 -0
  68. {imageio-2.37.3 → imageio-2.37.4}/imageio/core/imopen.py +0 -0
  69. {imageio-2.37.3 → imageio-2.37.4}/imageio/core/imopen.pyi +0 -0
  70. {imageio-2.37.3 → imageio-2.37.4}/imageio/core/legacy_plugin_wrapper.pyi +0 -0
  71. {imageio-2.37.3 → imageio-2.37.4}/imageio/core/request.pyi +0 -0
  72. {imageio-2.37.3 → imageio-2.37.4}/imageio/core/v3_plugin_api.py +0 -0
  73. {imageio-2.37.3 → imageio-2.37.4}/imageio/freeze.py +0 -0
  74. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/__init__.py +0 -0
  75. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/_dicom.py +0 -0
  76. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/_tifffile.py +0 -0
  77. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/dicom.py +0 -0
  78. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/example.py +0 -0
  79. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/feisem.py +0 -0
  80. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/ffmpeg.py +0 -0
  81. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/fits.py +0 -0
  82. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/freeimage.py +0 -0
  83. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/freeimagemulti.py +0 -0
  84. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/gdal.py +0 -0
  85. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/grab.py +0 -0
  86. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/lytro.py +0 -0
  87. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/npz.py +0 -0
  88. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/opencv.py +0 -0
  89. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/pillow_info.py +0 -0
  90. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/rawpy.py +0 -0
  91. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/simpleitk.py +0 -0
  92. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/spe.py +0 -0
  93. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/swf.py +0 -0
  94. {imageio-2.37.3 → imageio-2.37.4}/imageio/plugins/tifffile.py +0 -0
  95. {imageio-2.37.3 → imageio-2.37.4}/imageio/py.typed +0 -0
  96. {imageio-2.37.3 → imageio-2.37.4}/imageio/testing.py +0 -0
  97. {imageio-2.37.3 → imageio-2.37.4}/imageio/typing.py +0 -0
  98. {imageio-2.37.3 → imageio-2.37.4}/imageio/v2.py +0 -0
  99. {imageio-2.37.3 → imageio-2.37.4}/imageio/v2.pyi +0 -0
  100. {imageio-2.37.3 → imageio-2.37.4}/imageio/v3.py +0 -0
  101. {imageio-2.37.3 → imageio-2.37.4}/imageio/v3.pyi +0 -0
  102. {imageio-2.37.3 → imageio-2.37.4}/setup.cfg +0 -0
  103. {imageio-2.37.3 → imageio-2.37.4}/tests/conftest.py +0 -0
  104. {imageio-2.37.3 → imageio-2.37.4}/tests/test_bsdf.py +0 -0
  105. {imageio-2.37.3 → imageio-2.37.4}/tests/test_config.py +0 -0
  106. {imageio-2.37.3 → imageio-2.37.4}/tests/test_core.py +0 -0
  107. {imageio-2.37.3 → imageio-2.37.4}/tests/test_dicom.py +0 -0
  108. {imageio-2.37.3 → imageio-2.37.4}/tests/test_fei_tiff.py +0 -0
  109. {imageio-2.37.3 → imageio-2.37.4}/tests/test_ffmpeg.py +0 -0
  110. {imageio-2.37.3 → imageio-2.37.4}/tests/test_ffmpeg_info.py +0 -0
  111. {imageio-2.37.3 → imageio-2.37.4}/tests/test_fits.py +0 -0
  112. {imageio-2.37.3 → imageio-2.37.4}/tests/test_format.py +0 -0
  113. {imageio-2.37.3 → imageio-2.37.4}/tests/test_gdal.py +0 -0
  114. {imageio-2.37.3 → imageio-2.37.4}/tests/test_grab.py +0 -0
  115. {imageio-2.37.3 → imageio-2.37.4}/tests/test_legacy_plugin_wrapper.py +0 -0
  116. {imageio-2.37.3 → imageio-2.37.4}/tests/test_lytro.py +0 -0
  117. {imageio-2.37.3 → imageio-2.37.4}/tests/test_meta.py +0 -0
  118. {imageio-2.37.3 → imageio-2.37.4}/tests/test_npz.py +0 -0
  119. {imageio-2.37.3 → imageio-2.37.4}/tests/test_opencv.py +0 -0
  120. {imageio-2.37.3 → imageio-2.37.4}/tests/test_pillow.py +0 -0
  121. {imageio-2.37.3 → imageio-2.37.4}/tests/test_pillow_legacy.py +0 -0
  122. {imageio-2.37.3 → imageio-2.37.4}/tests/test_pyav.py +0 -0
  123. {imageio-2.37.3 → imageio-2.37.4}/tests/test_rawpy.py +0 -0
  124. {imageio-2.37.3 → imageio-2.37.4}/tests/test_simpleitk.py +0 -0
  125. {imageio-2.37.3 → imageio-2.37.4}/tests/test_spe.py +0 -0
  126. {imageio-2.37.3 → imageio-2.37.4}/tests/test_swf.py +0 -0
  127. {imageio-2.37.3 → imageio-2.37.4}/tests/test_tifffile.py +0 -0
  128. {imageio-2.37.3 → imageio-2.37.4}/tests/test_v2.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ImageIO
3
- Version: 2.37.3
3
+ Version: 2.37.4
4
4
  Summary: Read and write images and video across all major formats. Supports scientific and volumetric data.
5
5
  Author: ImageIO contributors
6
6
  Maintainer-email: Sebastian Wallkotter <sebastian@wallkoetter.net>, Almar Klein <almar.klein@gmail.com>
@@ -24,7 +24,7 @@ Classifier: Programming Language :: Python :: 3.12
24
24
  Classifier: Programming Language :: Python :: 3.13
25
25
  Classifier: Programming Language :: Python :: 3.14
26
26
  Requires-Python: >=3.10
27
- Description-Content-Type: text/x-rst
27
+ Description-Content-Type: text/markdown
28
28
  License-File: LICENSE
29
29
  Requires-Dist: numpy
30
30
  Requires-Dist: pillow>=8.3.2
@@ -89,7 +89,6 @@ Requires-Dist: fsspec[http]; extra == "all-plugins-pypy"
89
89
  Requires-Dist: imageio-ffmpeg; extra == "all-plugins-pypy"
90
90
  Requires-Dist: pillow-heif; extra == "all-plugins-pypy"
91
91
  Requires-Dist: psutil; extra == "all-plugins-pypy"
92
- Requires-Dist: tifffile; extra == "all-plugins-pypy"
93
92
  Provides-Extra: full
94
93
  Requires-Dist: astropy; extra == "full"
95
94
  Requires-Dist: av; extra == "full"
@@ -17,7 +17,6 @@ fsspec[http]
17
17
  imageio-ffmpeg
18
18
  pillow-heif
19
19
  psutil
20
- tifffile
21
20
 
22
21
  [bsdf]
23
22
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ImageIO
3
- Version: 2.37.3
3
+ Version: 2.37.4
4
4
  Summary: Read and write images and video across all major formats. Supports scientific and volumetric data.
5
5
  Author: ImageIO contributors
6
6
  Maintainer-email: Sebastian Wallkotter <sebastian@wallkoetter.net>, Almar Klein <almar.klein@gmail.com>
@@ -24,7 +24,7 @@ Classifier: Programming Language :: Python :: 3.12
24
24
  Classifier: Programming Language :: Python :: 3.13
25
25
  Classifier: Programming Language :: Python :: 3.14
26
26
  Requires-Python: >=3.10
27
- Description-Content-Type: text/x-rst
27
+ Description-Content-Type: text/markdown
28
28
  License-File: LICENSE
29
29
  Requires-Dist: numpy
30
30
  Requires-Dist: pillow>=8.3.2
@@ -89,7 +89,6 @@ Requires-Dist: fsspec[http]; extra == "all-plugins-pypy"
89
89
  Requires-Dist: imageio-ffmpeg; extra == "all-plugins-pypy"
90
90
  Requires-Dist: pillow-heif; extra == "all-plugins-pypy"
91
91
  Requires-Dist: psutil; extra == "all-plugins-pypy"
92
- Requires-Dist: tifffile; extra == "all-plugins-pypy"
93
92
  Provides-Extra: full
94
93
  Requires-Dist: astropy; extra == "full"
95
94
  Requires-Dist: av; extra == "full"
@@ -112,7 +112,7 @@ def get_remote_file(fname, directory=None, force_download=False, auto=True):
112
112
  if not op.isdir(op.dirname(filename)):
113
113
  os.makedirs(op.abspath(op.dirname(filename)))
114
114
  # let's go get the file
115
- if os.getenv("CONTINUOUS_INTEGRATION", False): # pragma: no cover
115
+ if os.getenv("CI"): # pragma: no cover
116
116
  # On CI, we retry a few times ...
117
117
  for i in range(2):
118
118
  try:
@@ -90,7 +90,7 @@ class LegacyPlugin(PluginV3):
90
90
  def legacy_get_reader(self, **kwargs):
91
91
  """legacy_get_reader(**kwargs)
92
92
 
93
- a utility method to provide support vor the V2.9 API
93
+ a utility method to provide support for the V2.9 API
94
94
 
95
95
  Parameters
96
96
  ----------
@@ -6,6 +6,7 @@ Definition of the Request object, which acts as a kind of bridge between
6
6
  what the user wants and what the plugins can.
7
7
  """
8
8
 
9
+ import errno
9
10
  import os
10
11
  from io import BytesIO
11
12
  import zipfile
@@ -52,12 +53,12 @@ class ImageMode(str, enum.Enum):
52
53
  ``Request.ImageMode`` and ``Request.IOMode``. The image mode that tells the
53
54
  plugin the desired (and expected) image shape. Available values are
54
55
 
55
- - single_image ("i"): Return a single image extending in two spacial
56
+ - single_image ("i"): Return a single image extending in two spatial
56
57
  dimensions
57
- - multi_image ("I"): Return a list of images extending in two spacial
58
+ - multi_image ("I"): Return a list of images extending in two spatial
58
59
  dimensions
59
60
  - single_volume ("v"): Return an image extending into multiple dimensions.
60
- E.g. three spacial dimensions for image stacks, or two spatial and one
61
+ E.g. three spatial dimensions for image stacks, or two spatial and one
61
62
  time dimension for videos
62
63
  - multi_volume ("V"): Return a list of images extending into multiple
63
64
  dimensions.
@@ -162,7 +163,7 @@ RETURN_BYTES = "<bytes>"
162
163
  EXAMPLE_IMAGES = {
163
164
  "astronaut.png": "Image of the astronaut Eileen Collins",
164
165
  "camera.png": "A grayscale image of a photographer",
165
- "checkerboard.png": "Black and white image of a chekerboard",
166
+ "checkerboard.png": "Black and white image of a checkerboard",
166
167
  "wood.jpg": "A (repeatable) texture of wooden planks",
167
168
  "bricks.jpg": "A (repeatable) texture of stone bricks",
168
169
  "clock.png": "Photo of a clock with motion blur (Stefan van der Walt)",
@@ -407,12 +408,16 @@ class Request(object):
407
408
  if is_read_request:
408
409
  # Reading: check that the file exists (but is allowed a dir)
409
410
  if not os.path.exists(fn):
410
- raise FileNotFoundError("No such file: '%s'" % fn)
411
+ raise FileNotFoundError(
412
+ errno.ENOENT, "No such file or directory", fn
413
+ )
411
414
  else:
412
415
  # Writing: check that the directory to write to does exist
413
416
  dn = os.path.dirname(fn)
414
417
  if not os.path.exists(dn):
415
- raise FileNotFoundError("The directory %r does not exist" % dn)
418
+ raise FileNotFoundError(
419
+ errno.ENOENT, "The directory does not exist", dn
420
+ )
416
421
 
417
422
  @property
418
423
  def filename(self):
@@ -153,11 +153,11 @@ class Array(np.ndarray):
153
153
  else:
154
154
  self._copy_meta({})
155
155
 
156
- def __array_wrap__(self, out, context=None):
156
+ def __array_wrap__(self, out, context=None, return_scalar=False):
157
157
  """So that we return a native numpy array (or scalar) when a
158
158
  reducting ufunc is applied (such as sum(), std(), etc.)
159
159
  """
160
- if not out.shape:
160
+ if return_scalar or not out.shape:
161
161
  return out.dtype.type(out) # Scalar
162
162
  elif out.shape != self.shape:
163
163
  return out.view(type=np.ndarray)
@@ -901,7 +901,7 @@ class NDArrayExtension(Extension):
901
901
  except ImportError: # pragma: no cover
902
902
  return v
903
903
  a = np.frombuffer(v["data"], dtype=v["dtype"])
904
- a.shape = v["shape"]
904
+ a = a.reshape(v["shape"])
905
905
  return a
906
906
 
907
907
 
@@ -1057,13 +1057,13 @@ class FIBitmap(FIBaseBitmap):
1057
1057
  array = numpy.frombuffer(bb, dtype=dtype).copy()
1058
1058
  # Deal with strides
1059
1059
  if len(shape) == 3:
1060
- array.shape = shape[2], strides[-1] // shape[0], shape[0]
1060
+ array = array.reshape(shape[2], strides[-1] // shape[0], shape[0])
1061
1061
  array2 = array[: shape[2], : shape[1], : shape[0]]
1062
1062
  array = numpy.zeros(shape, dtype=array.dtype)
1063
1063
  for i in range(shape[0]):
1064
1064
  array[i] = array2[:, :, i].T
1065
1065
  else:
1066
- array.shape = shape[1], strides[-1]
1066
+ array = array.reshape(shape[1], strides[-1])
1067
1067
  array = array[: shape[1], : shape[0]].T
1068
1068
  return array
1069
1069
 
@@ -652,13 +652,13 @@ def read_pixels(bb, i, tagType, L1):
652
652
  if tagType == 20:
653
653
  # DefineBitsLossless - RGB data
654
654
  try:
655
- a.shape = height, width, 3
655
+ a = a.reshape(height, width, 3)
656
656
  except Exception:
657
657
  # Byte align stuff might cause troubles
658
658
  logger.warning("Cannot read image due to byte alignment")
659
659
  if tagType == 36:
660
660
  # DefineBitsLossless2 - ARGB data
661
- a.shape = height, width, 4
661
+ a = a.reshape(height, width, 4)
662
662
  # Swap alpha channel to make RGBA
663
663
  b = a
664
664
  a = np.zeros_like(a)
@@ -101,7 +101,7 @@ class Image:
101
101
  if not isinstance(blob, bytes): # then it's a lazy bsdf.Blob
102
102
  blob = blob.get_bytes()
103
103
  self.array = np.frombuffer(blob, dtype=v["dtype"])
104
- self.array.shape = v["shape"]
104
+ self.array = self.array.reshape(v["shape"])
105
105
  return self.array
106
106
 
107
107
  def get_meta(self):
@@ -126,7 +126,7 @@ class PillowPlugin(PluginV3):
126
126
  warnings.warn(
127
127
  "Can't determine file format to write as. You _must_"
128
128
  " set `format` during write or the call will fail. Use "
129
- "`extension` to supress this warning. ",
129
+ "`extension` to suppress this warning. ",
130
130
  UserWarning,
131
131
  )
132
132
  return
@@ -187,7 +187,7 @@ class PillowPlugin(PluginV3):
187
187
  writable_output : bool
188
188
  If True, ensure that the image is writable before returning it to
189
189
  the user. This incurs a full copy of the pixel data if the data
190
- served by pillow is read-only. Consequentially, setting this flag to
190
+ served by pillow is read-only. Consequently, setting this flag to
191
191
  False improves performance for some images.
192
192
  pilmode : str
193
193
  Deprecated, use `mode` instead.
@@ -205,7 +205,7 @@ class PillowPlugin(PluginV3):
205
205
  -----
206
206
  If you read a paletted image (e.g. GIF) then the plugin will apply the
207
207
  palette by default. Should you wish to read the palette indices of each
208
- pixel use ``mode="P"``. The coresponding color pallete can be found in
208
+ pixel use ``mode="P"``. The corresponding color palette can be found in
209
209
  the image's metadata using the ``palette`` key when metadata is
210
210
  extracted using the ``exclude_applied=False`` kwarg. The latter is
211
211
  needed, as palettes are applied by default and hence excluded by default
@@ -290,7 +290,7 @@ class PillowPlugin(PluginV3):
290
290
  writable_output : bool
291
291
  If True, ensure that the image is writable before returning it to
292
292
  the user. This incurs a full copy of the pixel data if the data
293
- served by pillow is read-only. Consequentially, setting this flag to
293
+ served by pillow is read-only. Consequently, setting this flag to
294
294
  False improves performance for some images.
295
295
  """
296
296
 
@@ -321,7 +321,7 @@ class PillowPlugin(PluginV3):
321
321
  warnings.warn(
322
322
  "Loading 16-bit (uint16) PNG as int32 due to limitations "
323
323
  "in pillow's PNG decoder. This will be fixed in a future "
324
- "version of pillow which will make this warning dissapear.",
324
+ "version of pillow which will make this warning disappear.",
325
325
  UserWarning,
326
326
  )
327
327
  elif minor < 1: # pragma: no cover
@@ -442,7 +442,10 @@ class PillowPlugin(PluginV3):
442
442
  ndimage = ndimage[None, ...]
443
443
 
444
444
  for frame in ndimage:
445
- pil_frame = Image.fromarray(frame, mode=mode)
445
+ if mode is None:
446
+ pil_frame = Image.fromarray(frame)
447
+ else:
448
+ pil_frame = Image.fromarray(frame, mode=mode)
446
449
  if "bits" in kwargs:
447
450
  pil_frame = pil_frame.quantize(colors=2 ** kwargs["bits"])
448
451
  self.images_to_write.append(pil_frame)
@@ -335,7 +335,7 @@ class PillowFormat(Format):
335
335
  self._seek(i)
336
336
  if self._im.palette and self._im.palette.dirty:
337
337
  self._im.palette.rawmode_saved = self._im.palette.rawmode
338
- self._im.getdata()[0]
338
+ self._im.load()
339
339
  im = pil_get_frame(self._im, **self._kwargs)
340
340
  return im, self._im.info
341
341
 
@@ -642,7 +642,7 @@ def save_pillow_close(im):
642
642
  def pil_try_read(im):
643
643
  try:
644
644
  # this will raise an IOError if the file is not readable
645
- im.getdata()[0]
645
+ im.load()
646
646
  except IOError as e:
647
647
  site = "http://pillow.readthedocs.io/en/latest/installation.html"
648
648
  site += "#external-libraries"
@@ -705,14 +705,18 @@ def pil_get_frame(im, is_gray=None, as_gray=None, mode=None, dtype=None):
705
705
  # We can do this ourselves. Pillow seems to sometimes screw
706
706
  # this up if a multi-gif has a palette for each frame ...
707
707
  # Create palette array
708
- p = np.frombuffer(im.palette.getdata()[1], np.uint8)
708
+ if hasattr(im.palette, "tobytes"):
709
+ palette_bytes = im.palette.tobytes()
710
+ else: # pragma: no cover
711
+ palette_bytes = im.palette.getdata()[1]
712
+ p = np.frombuffer(palette_bytes, np.uint8)
709
713
  # Restore the raw mode that was saved to be used to parse the palette
710
714
  if hasattr(im.palette, "rawmode_saved"):
711
715
  im.palette.rawmode = im.palette.rawmode_saved
712
716
  mode = im.palette.rawmode if im.palette.rawmode else im.palette.mode
713
717
  nchannels = len(mode)
714
718
  # Shape it.
715
- p.shape = -1, nchannels
719
+ p = p.reshape(-1, nchannels)
716
720
  if p.shape[1] == 3 or (p.shape[1] == 4 and mode[-1] == "X"):
717
721
  p = np.column_stack((p[:, :3], 255 * np.ones(p.shape[0], p.dtype)))
718
722
  # Swap the axes if the mode is in BGR and not RGB
@@ -766,7 +770,7 @@ def pil_get_frame(im, is_gray=None, as_gray=None, mode=None, dtype=None):
766
770
  if "S" in im.mode:
767
771
  dtype = dtype.replace("u", "i")
768
772
  frame = np.frombuffer(frame.tobytes(), dtype).copy()
769
- frame.shape = shape[::-1]
773
+ frame = frame.reshape(shape[::-1])
770
774
  else:
771
775
  # Use uint16 for PNG's in mode I
772
776
  if im.format == "PNG" and im.mode == "I" and dtype is None:
@@ -134,7 +134,7 @@ class GifWriter: # pragma: no cover
134
134
  im_rect, rect = self.getSubRectangle(im)
135
135
  im_pil = self.converToPIL(im_rect, self.opt_quantizer, self.opt_palette_size)
136
136
 
137
- # Get pallette - apparently, this is the 3d element of the header
137
+ # Get palette - apparently, this is the 3d element of the header
138
138
  # (but it has not always been). Best we've got. Its not the same
139
139
  # as im_pil.palette.tobytes().
140
140
  from PIL.GifImagePlugin import getheader
@@ -215,7 +215,7 @@ class GifWriter: # pragma: no cover
215
215
  Modified by Alex Robinson in Janurari 2011 to implement subrectangles.
216
216
  """
217
217
 
218
- # Defaule use full image and place at upper left
218
+ # Default: use full image and place at upper left
219
219
  if xy is None:
220
220
  xy = (0, 0)
221
221
 
@@ -232,7 +232,7 @@ class GifWriter: # pragma: no cover
232
232
  # reserved00, lct size111=7=2^(7 + 1)=256.
233
233
  bb += b"\x87"
234
234
 
235
- # LZW minimum size code now comes later, begining of [imagedata] blocks
235
+ # LZW minimum size code now comes later, beginning of [imagedata] blocks
236
236
  return bb
237
237
 
238
238
  def getAppExt(self, loop):
@@ -254,7 +254,7 @@ class GifWriter: # pragma: no cover
254
254
 
255
255
  def getGraphicsControlExt(self, duration=0.1, dispose=2):
256
256
  """Graphics Control Extension. A sort of header at the start of
257
- each image. Specifies duration and transparancy.
257
+ each image. Specifies duration and transparency.
258
258
 
259
259
  Dispose
260
260
  -------
@@ -274,7 +274,7 @@ class GifWriter: # pragma: no cover
274
274
  # 2nd bit 1 == user input , next 3 bits, the low two of which are used,
275
275
  # are dispose.
276
276
  bb += intToBin(int(duration * 100 + 0.5)) # in 100th of seconds
277
- bb += b"\x00" # no transparant color
277
+ bb += b"\x00" # no transparent color
278
278
  bb += b"\x00" # end
279
279
  return bb
280
280
 
@@ -516,7 +516,7 @@ class PyAVPlugin(PluginV3):
516
516
  variable_fps = bool(self._container.format.flags & 0x400)
517
517
  constant_framerate = not variable_fps
518
518
 
519
- # note: cheap for contigous incremental reads
519
+ # note: cheap for contiguous incremental reads
520
520
  self._seek(index, constant_framerate=constant_framerate)
521
521
  desired_frame = next(self._decoder)
522
522
  self._next_idx += 1
@@ -1150,7 +1150,7 @@ class PyAVPlugin(PluginV3):
1150
1150
  planes.append(np_plane)
1151
1151
 
1152
1152
  if len(planes) > 1:
1153
- # Note: the planes *should* exist inside a contigous memory block
1153
+ # Note: the planes *should* exist inside a contiguous memory block
1154
1154
  # somewhere inside av.Frame however pyAV does not appear to expose this,
1155
1155
  # so we are forced to copy the planes individually instead of wrapping
1156
1156
  # them :(
@@ -1198,7 +1198,7 @@ class PyAVPlugin(PluginV3):
1198
1198
 
1199
1199
  index_pts = int(index * pts_delta)
1200
1200
 
1201
- # this only seeks to the closed (preceeding) keyframe
1201
+ # this only seeks to the closest (preceding) keyframe
1202
1202
  self._container.seek(index_pts, stream=self._video_stream)
1203
1203
  self._decoder = self._container.decode(video=0)
1204
1204
 
@@ -215,13 +215,29 @@ class TifffilePlugin(PluginV3):
215
215
  create new series unless ``contiguous=True`` is used, in which case the
216
216
  call to write will append to the current series.
217
217
 
218
+ When ``photometric`` / ``planarconfig`` are omitted, ImageIO sets
219
+ defaults for common RGB layouts so tifffile does not emit deprecation
220
+ warnings about ambiguous channel-axis interpretation:
221
+
222
+ - channel-last arrays (shape ``(..., 3)`` or ``(..., 4)``):
223
+ ``photometric="rgb"``
224
+ - channel-first arrays (shape ``(3, ...)`` or ``(4, ...)`` on the
225
+ third-to-last axis): ``photometric="rgb"`` and
226
+ ``planarconfig="separate"``
218
227
  """
219
228
 
220
229
  if not is_batch:
221
230
  ndimage = np.asarray(ndimage)[None, :]
222
231
 
223
232
  for image in ndimage:
224
- self._fh.write(image, **kwargs)
233
+ write_kwargs = dict(kwargs)
234
+ arr = np.asarray(image)
235
+ if arr.ndim >= 3 and arr.shape[-1] in (3, 4):
236
+ write_kwargs.setdefault("photometric", "rgb")
237
+ elif arr.ndim >= 3 and arr.shape[-3] in (3, 4):
238
+ write_kwargs.setdefault("photometric", "rgb")
239
+ write_kwargs.setdefault("planarconfig", "separate")
240
+ self._fh.write(image, **write_kwargs)
225
241
 
226
242
  if self._request._uri_type == URI_BYTES:
227
243
  self._fh.close()
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ImageIO"
7
- version = "2.37.3"
7
+ version = "2.37.4"
8
8
  authors = [
9
9
  {name = "ImageIO contributors"}
10
10
  ]
@@ -123,7 +123,6 @@ all-plugins-pypy = [
123
123
  "imageio-ffmpeg",
124
124
  "pillow-heif",
125
125
  "psutil",
126
- "tifffile",
127
126
  ]
128
127
  full = [
129
128
  "astropy",
@@ -149,7 +148,7 @@ zip-safe = false
149
148
  packages = ["imageio", "imageio.core", "imageio.plugins", "imageio.config"]
150
149
 
151
150
  [tool.setuptools.dynamic]
152
- readme = {file = ["README.md"]}
151
+ readme = {file = ["README.md"], content-type = "text/markdown"}
153
152
 
154
153
  [tool.setuptools.package-data]
155
154
  imageio = ["py.typed", "**/*.pyi", "*.pyi"]
@@ -4,44 +4,45 @@ import os
4
4
  import shutil
5
5
  import sys
6
6
  import platform
7
+ import time
7
8
  import warnings
8
9
 
9
- import fsspec # type: ignore
10
10
  import imageio.plugins
11
11
  import imageio.v3 as iio3
12
12
  import imageio.v2 as iio
13
13
  import numpy as np
14
14
  import pytest
15
15
  from imageio import core
16
- from imageio.core import IS_PYPY
16
+ from imageio.core import IS_PYPY, get_platform
17
+ from imageio.plugins._freeimage import FNAME_PER_PLATFORM, download
17
18
  from pytest import raises
18
19
  from conftest import deprecated_test
19
20
 
20
21
 
21
22
  @pytest.fixture(scope="module")
22
- def vendored_lib(request, tmp_path_factory):
23
+ def vendored_lib(tmp_path_factory):
24
+ """Download FreeImage binaries via raw.githubusercontent.com (with retries)."""
25
+ plat = get_platform()
26
+ if not plat or plat not in FNAME_PER_PLATFORM:
27
+ pytest.skip("No FreeImage binary for this platform")
28
+
23
29
  lib_dir = tmp_path_factory.mktemp("freeimage_dir")
30
+ last_exc = None
31
+ for attempt in range(4):
32
+ try:
33
+ download(directory=str(lib_dir))
34
+ break
35
+ except Exception as exc:
36
+ last_exc = exc
37
+ time.sleep(0.5 * (2**attempt))
38
+ else:
39
+ pytest.skip(f"Could not download FreeImage binaries: {last_exc}")
24
40
 
25
- if platform.system() == "Linux":
26
- lib_extension = ".so"
27
- elif platform.system() == "Darwin":
28
- lib_extension = ".dylib"
29
- elif platform.system() == "Windows":
30
- lib_extension = ".dll"
31
-
32
- fs = fsspec.filesystem(
33
- "github",
34
- org="imageio",
35
- repo="imageio-binaries",
36
- username=request.config.getoption("--github-username"),
37
- token=request.config.getoption("--github-token"),
38
- )
39
- fs.get(
40
- [x for x in fs.ls("freeimage/") if x.endswith(lib_extension)],
41
- lib_dir.as_posix(),
42
- )
41
+ freeimage_dir = lib_dir / "freeimage"
42
+ if not freeimage_dir.is_dir() or not any(freeimage_dir.iterdir()):
43
+ pytest.skip("FreeImage download did not produce expected files")
43
44
 
44
- yield lib_dir
45
+ yield freeimage_dir
45
46
 
46
47
 
47
48
  # TODD: update fixture once we transition into v3
@@ -616,7 +617,7 @@ def test_multi_icon_ico(setup_library, tmp_path):
616
617
 
617
618
  im = get_ref_im(4, 0, 0)[:32, :32]
618
619
  ims = [np.repeat(np.repeat(im, i, 1), i, 0) for i in (1, 2)] # SegF on win
619
- ims = im, np.column_stack((im, im)), np.row_stack((im, im)) # error on win
620
+ ims = im, np.column_stack((im, im)), np.vstack((im, im)) # error on win
620
621
  iio.mimsave(fnamebase + "I2.ico", ims, format="ICO-FI")
621
622
  ims2 = iio.mimread(fnamebase + "I2.ico", format="ICO-FI")
622
623
  for im1, im2 in zip(ims, ims2):
@@ -94,7 +94,12 @@ def test_planarconfig(tmp_path):
94
94
  if tuple(int(x) for x in tifffile.__version__.split(".")) <= (2021, 11, 2):
95
95
  assert tif.series[0].pages[0].tags[284].value == 2
96
96
  else:
97
- assert tif.series[0].dims == ("sample", "height", "width")
97
+ # tifffile 2026.6.1+ (Python >= 3.12) uses axes codes; earlier
98
+ # releases still report long dim names.
99
+ assert tif.series[0].dims in (
100
+ ("sample", "height", "width"),
101
+ ("S", "Y", "X"),
102
+ )
98
103
 
99
104
 
100
105
  def test_metadata_reading(test_images):
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes