Skip to main content

Crate atx_reader

Crate atx_reader 

Source
Expand description

Parser and decoder for Apple .atx texture archives.

The .atx format is an AAPL-container (RIFF-style chunked file) that wraps ASTC-compressed image data. It is produced by Apple tooling and surfaces in third-party forensic exports such as Cellebrite UFED.

§Quick start

use std::fs;

let bytes = fs::read("snapshot.atx").unwrap();

// High-level API — returns RGBA8 pixels at the original (width, height).
let img = atx_reader::decode(&bytes).unwrap();
assert_eq!(img.pixels.len(), (img.width * img.height * 4) as usize);

// With the `image` feature, you can save directly:
let rgba = atx_reader::decode_to_image(&bytes).unwrap();
rgba.save("snapshot.png").unwrap();

§What this crate decodes

The format was reverse-engineered from real .atx samples. The current implementation handles the layout used by iOS lock-screen / thumbnail exports:

  • AAPL\r\n\x1a\n container signature
  • HEAD chunk carrying width / height / depth / mipmap count / a 16-byte texture UUID and two pixel-format discriminator words
  • FILL padding chunks (skipped)
  • An astc payload chunk holding raw ASTC blocks laid out in Apple’s macro-tiled Morton ordering

Single-mip, single-layer, 2D, ASTC 4×4 is the default decoding path. The lower-level AtxContainer / AtxDecoder API exposes everything else (chunk iteration, format codes, custom footprint, custom payload layout) for callers that need to support new samples.

Structs§

AtxChunk
A non-owning view of one chunk inside an AAPL container.
AtxContainer
A zero-copy view over a .atx file’s bytes.
AtxDecoder
Lower-level decoder. Useful when you already hold a parsed header and payload, or want to tweak options between parsing and decoding.
AtxHeader
Parsed metadata from the HEAD chunk.
ChunkIter
Iterator over the chunks following the AAPL magic.
DecodeOptions
Options controlling the decode.
DecodedImage
An RGBA8 image produced by decode / decode_with.

Enums§

AstcFootprint
All ASTC 2D block footprints, mirroring astc-decode::Footprint.
AtxError
Errors produced while parsing or decoding a .atx file.
PayloadLayout
How the raw ASTC blocks are laid out inside the astc payload.
TexturePayload
Texture payload variants exposed by AtxContainer::texture_payload.

Constants§

AAPL_MAGIC
8-byte container signature: b"AAPL\r\n\x1a\n".
ASTC_TAG
astc chunk tag — raw ASTC payload, optionally swizzled.
FILL_TAG
FILL chunk tag — zero-padding for GPU alignment.
HEAD_TAG
HEAD chunk tag — texture metadata block.
LZFS_TAG
LZFS chunk tag — LZFSE-compressed ASTC payload (bvx2 stream).

Functions§

decode
Convenience: parse + decode in one call, using default options (ASTC 4×4, Apple macro-tiled Morton with macro_blocks = 32).
decode_to_image
Decode an .atx to an image::RgbaImage.
decode_with
Convenience: parse + decode using custom options. Auto-detects the payload variant (astc chunk vs LZFSE-compressed LZFS chunk) and the appropriate default layout when the user did not specify one.

Type Aliases§

Result