image_utils module
Various utilities for working with Pillow images
- mip_sizes(dimensions: Tuple[int, int], mip_count: int | None = None) List[Tuple[int, int]]
Create a chain of mipmap sizes for a given source source size, where each source is half the size of the one before. Note that the division by 2 rounds down. So a 63x63 texture has as its next lowest mipmap level 31x31. And so on.
See the OpenGL wiki page on mipmaps for more info.
- Parameters:
dimensions – Size of the source source in pixels
mip_count – Number of mipmap sizes to generate. By default, generate until the last mip level is 1x1. Resulting mip chain will be smaller if a 1x1 mip level is reached before this value.
- Returns:
A list of 2-tuples representing the dimensions of each mip level, including
dimensionsat element 0.