#texture #image-processing #crunch #dxt

decrunch-unity

Decoder for crunch-compressed texture data, using the Unity fork of the crunch library

1 unstable release

Uses old Rust 2015

new 0.1.2 May 18, 2025

#593 in Game dev

Download history 109/week @ 2025-05-14

109 downloads per month

MIT license

1.5MB
41K SLoC

C++ 40K SLoC // 0.0% comments Visual Studio Project 557 SLoC Rust 278 SLoC // 0.2% comments

Decoder for crunch-compressed texture data

This crate provides a Rust wrapper around crunch's decompressor.

Example

use decrunch::*;
use std::fs::File;
use std::io::Read;

let mut compressed_file = File::open("testdata/copyright_2048_compressed.dat")?;
let mut compressed_data = Vec::new();

compressed_file.read_to_end(&mut compressed_data)?;

let c_data = CrunchedData::new(&compressed_data);
let decompressed_data = match c_data.decode_level(0) {
    None => {
        panic!("Failed to decompress texture data");
    }
    Some(res) => res,
};

assert!(decompressed_data.len() > 0);


Decoder for crunch-compressed texture data

Crates.io Documentation

This crate provides a Rust wrapper around the Unity fork of the crunch decompressor.

Example

use decrunch::*;
use std::fs::File;
use std::io::Read;

let mut compressed_file = File::open("testdata/copyright_2048_compressed.dat")?;
let mut compressed_data = Vec::new();

compressed_file.read_to_end(&mut compressed_data)?;

let c_data = CrunchedData::new(&compressed_data);
let decompressed_data = match c_data.decode_level(0) {
    None => {
        panic!("Failed to decompress texture data");
    }
    Some(res) => res,
};

assert!(decompressed_data.len() > 0);

Dependencies