Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion python/ndstorage/ndtiff_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,16 @@ def _write_ifd(self, index_key, pixels, metadata, rgb, image_height, image_width
if self.file.tell() % 2 == 1:
self.file.seek(self.file.tell() + 1) # Make IFD start on word

byte_depth = 1 if isinstance(pixels, bytearray) else 2
if isinstance(pixels, bytearray):
byte_depth = 1
# if the pixel object is a numpy array, it is type of <class 'numpy.ndarray'>
# when using np_array.tobytes it is <class 'bytes'>
# therefore taking the the bit_depth information "pixels.dtype" into account
elif bit_depth == 8:
byte_depth = 1
else:
byte_depth = 2

bytes_per_image_pixels = self._bytes_per_image_pixels(pixels, rgb)
num_entries = 13

Expand Down
Loading