pub fn decode(bytes: &[u8]) -> Result<DecodedImage, AtxError>Expand description
Decode the texture payload to RGBA8.
Tier-1 validated: output matches the independent iLEAPP oracle to within one
LSB per channel on 108 real iOS 17.3 device textures (see docs/validation.md).
Examples found in repository?
examples/decode_atx.rs (line 22)
14fn main() -> Result<(), Box<dyn Error>> {
15 let mut args = std::env::args().skip(1);
16 let (Some(input), Some(output)) = (args.next(), args.next()) else {
17 eprintln!("usage: decode_atx <input.atx> <output.rgba>");
18 std::process::exit(2);
19 };
20
21 let bytes = std::fs::read(&input)?;
22 match atx_core::decode(&bytes) {
23 Ok(img) => {
24 std::fs::write(&output, &img.rgba)?;
25 println!("OK {} {} {:?}", img.width, img.height, img.confidence);
26 Ok(())
27 }
28 Err(e) => {
29 println!("ERR {e}");
30 std::process::exit(1);
31 }
32 }
33}