A library for converting uncompressed image data to and from compressed formats.
The provided example projects demonstrate basic usage of the conversion functions. The library also provides functions for working directly with the raw bytes of a surface instead of a dds or image file.
cargo run --release --example img2dds image.png out.dds BC3Unorm
cargo run --release --example dds2img out.dds out.tiff
The only compressed formats supported at this time are BCN formats since these are the formats commonly used by DDS files and compressed GPU textures. This library does not support other compressed formats used for GPU textures like ETC1. Compression is handled using intel-tex-rs-2 for bindings to Intel's ISPC texture compressor in C++. Decompression is handled using bindings to the bcdec library in C.
| Format | Encode | Decode | | --- | --- | --- | | BC1 | :heavycheckmark: | :heavycheckmark: | | BC2 | :x: | :heavycheckmark: | | BC3 | :heavycheckmark: | :heavycheckmark: | | BC4 | :heavycheckmark: | :heavycheckmark: | | BC5 | :heavycheckmark: | :heavycheckmark: | | BC6 | :heavycheckmark: | :heavycheckmark: | | BC7 | :heavycheckmark: | :heavycheckmark: |
Some uncompressed formats are also supported. These formats are supported by DDS but are rarely used with DDS files in practice. Uncompressed formats are often used for small textures or textures used for window surfaces and UI elements. Like compressed formats, uncompressed formats can be encoded and decoded to and from RGBA8.
| Format | Encode | Decode | | --- | --- | --- | | R8 | :heavycheckmark: | :heavycheckmark: | | R8G8B8A8 | :heavycheckmark: | :heavycheckmark: | | R8G8B8A8 | :heavycheckmark: | :heavycheckmark: | | R32G32B32A32 | :heavycheckmark: | :heavycheckmark: | | B8G8R8A8 | :heavycheckmark: | :heavycheckmark: |
Helper functions for working with the files from the image and ddsfile crates are supported under feature flags and enabled by default.
Build the projects using cargo build --release
with a newer version of the Rust toolchain installed. Builds support Windows, Linux, and MacOS. Some targets may not build properly due to a lack of precompiled ISP kernels in intel-tex-rs-2.