Crate bcndecode [] [src]

Decoder for DXTn-compressed data

This crate provides methods to decompress DXTn-compressed image data.

The following formats are currently supported:

  • Bc1: 565 color, 1-bit alpha (dxt1)
  • Bc2: 565 color, 4-bit alpha (dxt3)
  • Bc3: 565 color, 2-endpoint 8-bit interpolated alpha (dxt5)
  • Bc4: 1-channel 8-bit via 1 BC3 alpha block
  • Bc5: 2-channel 8-bit via 2 BC3 alpha blocks
  • Bc6: 3-channel 16-bit float

The following formats are not implemented:

  • Bc7: 4-channel 8-bit via everything

Format documentation for BC1-BC5

BC6 and BC7 are described here:

The decompression code was based on the original C code used in the Python Pillow Imaging package



Specifies the pixel format of the output data


Encoding type of the source data.


The error type for all bcn decoding operations.



Decodes the given BCN encoded image data. On success, the decoded data as a byte vector is returned.