diff --git a/quicktex/dds.py b/quicktex/dds.py index a58a744..af29e06 100644 --- a/quicktex/dds.py +++ b/quicktex/dds.py @@ -166,7 +166,7 @@ class DDSFile: # WRITE HEADER file.write(struct.pack('<7I44x', DDSFile.header_bytes, int(self.flags), self.size[1], self.size[0], self.pitch, self.depth, self.mipmap_count)) - file.write(struct.pack('<2I4s5I', 32, int(self.flags), bytes(self.four_cc, 'ascii'), self.pixel_size, *self.pixel_bitmasks)) + file.write(struct.pack('<2I4s5I', 32, int(self.pfflags), bytes(self.four_cc, 'ascii'), self.pixel_size, *self.pixel_bitmasks)) file.write(struct.pack('<4I4x', *self.caps)) assert file.tell() == 4 + DDSFile.header_bytes, 'error writing file: incorrect header size' diff --git a/quicktex/image_utils.py b/quicktex/image_utils.py index 51b34aa..28d120a 100644 --- a/quicktex/image_utils.py +++ b/quicktex/image_utils.py @@ -19,7 +19,7 @@ def mip_sizes(dimensions: Tuple[int, int], mip_count: Optional[int] = None) -> L """ assert all([dim > 0 for dim in dimensions]), "Invalid source dimensions" if not mip_count: - mip_count = math.ceil(math.log2(max(dimensions))) # maximum possible number of mips for a given source + mip_count = math.ceil(math.log2(max(dimensions)) + 1) # maximum possible number of mips for a given source assert mip_count > 0, "mip_count must be greater than 0"