- add null byte add end of description
- do not raise Exception when frame 0 was not added so that the external error causing it can be debugged
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "tiffwrite"
|
||||
version = "2024.3.0"
|
||||
version = "2024.4.0"
|
||||
description = "Parallel tiff writer compatible with ImageJ."
|
||||
authors = ["Wim Pomp, Lenstra lab NKI <w.pomp@nki.nl>"]
|
||||
license = "GPL-3.0-or-later"
|
||||
|
||||
@@ -452,7 +452,7 @@ class IJTiffFile:
|
||||
desc_bytes.append(self.comment)
|
||||
else:
|
||||
desc_bytes.append(bytes(self.comment, 'ascii'))
|
||||
return b'\n'.join(desc_bytes)
|
||||
return b'\n'.join(desc_bytes) + b'\0'
|
||||
|
||||
@cached_property
|
||||
def colormap_bytes(self) -> Optional[bytes]:
|
||||
@@ -485,11 +485,12 @@ class IJTiffFile:
|
||||
for n, tags in self.frame_extra_tags.items():
|
||||
framenr, channel = self.get_frame_number(n)
|
||||
ifds[framenr].update(tags)
|
||||
if self.colormap is not None:
|
||||
if 0 in ifds and self.colormap is not None:
|
||||
ifds[0][320] = Tag('SHORT', self.colormap_bytes)
|
||||
ifds[0][262] = Tag('SHORT', 3)
|
||||
if self.colors is not None:
|
||||
for c, color in enumerate(self.colors_bytes):
|
||||
if c in ifds:
|
||||
ifds[c][320] = Tag('SHORT', color)
|
||||
ifds[c][262] = Tag('SHORT', 3)
|
||||
if 0 in ifds and 306 not in ifds[0]:
|
||||
@@ -518,7 +519,7 @@ class IJTiffFile:
|
||||
wrn = True
|
||||
if wrn:
|
||||
warnings.warn('Some frames were not added to the tif file, either you forgot them, '
|
||||
'or an error occured and the tif file was closed prematurely.')
|
||||
'or an error occurred and the tif file was closed prematurely.')
|
||||
|
||||
def __enter__(self) -> IJTiffFile:
|
||||
return self
|
||||
|
||||
Reference in New Issue
Block a user