dds module
- class PFFlags(value)
Values which indicate what type of data is in the surface.
- ALPHAPIXELS = 1
Texture contains alpha data (
pixel_bitmasks[3]
contains valid data).
- ALPHA = 2
Used in some older DDS files for alpha channel only uncompressed data (
pixel_size
contains the alpha channel bitcount;pixel_bitmasks[3]
contains valid data).
- FOURCC = 4
Texture contains compressed RGB data;
four_cc
contains valid data.
- RGB = 64
Texture contains uncompressed RGB data;
pixel_size
and the RGB masks (pixel_bitmasks[0:3]
) contain valid data.
- YUV = 512
Used in some older DDS files for YUV uncompressed data (
pixel_size
contains the YUV bit count;pixel_bitmasks[0]
contains the Y mask,pixel_bitmasks[1]
contains the U mask,pixel_bitmasks[2]
contains the V mask).
- LUMINANCE = 131072
Used in some older DDS files for single channel color uncompressed data (
pixel_size
contains the luminance channel bit count;pixel_bitmasks[0]
contains the channel mask). Can be combined withALPHAPIXELS
for a two channel uncompressed DDS file.
- class DDSFlags(value)
Flags to indicate which members contain valid data.
- CAPS = 1
Required in every .dds file.
- HEIGHT = 2
Required in every .dds file.
- WIDTH = 4
Required in every .dds file.
- PITCH = 8
Required when
pitch
is provided for an uncompressed texture.
- PIXEL_FORMAT = 4096
Required in every .dds file.
- MIPMAPCOUNT = 131072
Required when
mipmap_count
is provided for a mipmapped texture.
- LINEAR_SIZE = 524288
Required when
pitch
is provided for a compressed texture.
- DEPTH = 8388608
Required when
depth
is provided for a depth texture.
- class Caps0(value)
Flags to indicate surface complexity
- COMPLEX = 8
Optional; must be used on any file that contains more than one surface (a mipmap, a cubic environment map, or mipmapped volume texture).
- MIPMAP = 4194304
Optional; should be used for a mipmap.
- TEXTURE = 4096
Required
- final class DDSFile
A microsoft DDS file, containing header information and one or more textures
For more information, see microsoft’s Reference for DDS.
- magic = b'DDS '
Magic bytes at the start of every DDS file.
- extension = 'dds'
Extension for a DDS file.
- header_bytes = 124
The size of a DDS header in bytes.
- flags: quicktex.dds.DDSFlags
Flags to indicate which members contain valid data.
- pitch: int
The pitch or number of bytes per row in an uncompressed texture; the total number of bytes in the top level texture for a compressed texture.
- pf_flags: quicktex.dds.PFFlags
Flags representing which pixel format data is valid.
- four_cc: str
FourCC code of the texture format. Valid texture format strings are
DXT1
,DXT2
,DXT3
,DXT4
, orDXT5
. If a DirectX 10 header is used, this isDX10
.
- caps: Tuple[quicktex.dds.Caps0, int, int, int]
Specifies the complexity of the surfaces stored.
- textures: List
A list of bytes objects for each texture in the file
- format: quicktex.dds.DDSFormat
The format used by this dds file
- save(path: os.PathLike) None
Save the DDSFile to a file :param path: string or path-like object to write to
- decode(mip: int = 0, *args, **kwargs) PIL.Image.Image
Decode a single texture in the file to images :param mip: the mip level to decode. Default: 0 :return: The decoded image
- decode_all(*args, **kwargs) List[PIL.Image.Image]
Decade all textures in the file to images :return: the decoded images