numpyimage 2.7.0__tar.gz → 2.8.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: numpyimage
3
- Version: 2.7.0
3
+ Version: 2.8.0
4
4
  Summary: Load, save, & manipulate image files as numpy arrays
5
5
  Author-email: Jasper Phelps <jasper.s.phelps@gmail.com>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -440,7 +440,13 @@ class VideoWriter:
440
440
 
441
441
  def write(self, frame):
442
442
  if not isinstance(frame, self.av.VideoFrame):
443
- if frame.ndim == 3 and frame.shape[-1] == 3:
443
+ if not isinstance(frame, np.ndarray):
444
+ frame = np.array(frame)
445
+ if frame.ndim == 4:
446
+ for i in range(frame.shape[0]):
447
+ self.write(frame[i])
448
+ return
449
+ elif frame.ndim == 3 and frame.shape[-1] == 3:
444
450
  frame = self.av.VideoFrame.from_ndarray(frame, format='rgb24')
445
451
  elif frame.ndim == 3 and frame.shape[-1] == 4:
446
452
  # While some video codecs support an alpha channel, most don't,
@@ -449,7 +455,8 @@ class VideoWriter:
449
455
  elif frame.ndim == 2:
450
456
  frame = self.av.VideoFrame.from_ndarray(frame, format='gray')
451
457
  else:
452
- raise ValueError(f'Frame must be (H, W) (H, W, 3) or (H, W, 4) but was {frame.shape}')
458
+ raise ValueError('Frame must have shape (H, W) (H, W, 3) (H, W, 4)'
459
+ f' (t, H, W, 3) or (t, H, W, 4) but was {frame.shape}')
453
460
  if self.stream.width == 0:
454
461
  self.stream.width = frame.width
455
462
  if self.stream.height == 0:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: numpyimage
3
- Version: 2.7.0
3
+ Version: 2.8.0
4
4
  Summary: Load, save, & manipulate image files as numpy arrays
5
5
  Author-email: Jasper Phelps <jasper.s.phelps@gmail.com>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta'
4
4
 
5
5
  [project]
6
6
  name = 'numpyimage'
7
- version = '2.7.0'
7
+ version = '2.8.0'
8
8
  description = 'Load, save, & manipulate image files as numpy arrays'
9
9
  readme.file = 'README.md'
10
10
  readme.content-type = 'text/markdown'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes