diff --git a/Cargo.lock b/Cargo.lock index e3dc8cbb2..dcdb4f274 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2083,6 +2083,7 @@ dependencies = [ "craft-exr 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3b8e426a260695af840a2cd79a064d40778f939e)", "craft-gif", "craft-media 0.1.0 (git+https://github.com/storytold/craft-libs?rev=33be35625e252cc4f06aa375b3b428521faea37d)", + "craft-tga", "craft-video", "effectcraft-color", "effectcraft-effects", diff --git a/Cargo.toml b/Cargo.toml index 627ea1365..376772e5b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,6 +22,7 @@ craft-dpx = { version = "0.1.0", git = "https://github.com/storytold/craft-libs" craft-ps = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "068e079c7be4b100a8a6b305b31ac881e069727e", default-features = false, features = ["read"] } craft-exr = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3b8e426a260695af840a2cd79a064d40778f939e" } craft-gif = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "ba25ccd233934d1b2f74e3c0f235168bf5f13ef3" } +craft-tga = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "33be35625e252cc4f06aa375b3b428521faea37d" } craft-psd = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "53198114310dbc2b41e18e4eaf2fd83e69964189" } craft-codepage = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5a7a63a21dd03dd1a2bc6c308a3a6ce818caae87" } craft-svg = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3dff4793f1a5bd1f99a4fe3280d48f515158dff3" } diff --git a/crates/export/Cargo.toml b/crates/export/Cargo.toml index 6b93a8a7c..a810d21c2 100644 --- a/crates/export/Cargo.toml +++ b/crates/export/Cargo.toml @@ -18,6 +18,7 @@ craft-video = { workspace = true } craft-audio = { workspace = true } craft-media = { workspace = true } craft-gif = { workspace = true } +craft-tga = { workspace = true } craft-exr = { workspace = true, features = ["decode"] } image = { workspace = true, features = ["png", "jpeg", "tiff", "exr", "tga"] } rayon = { workspace = true } diff --git a/crates/export/src/lib.rs b/crates/export/src/lib.rs index 16d65fabe..b89acbbab 100644 --- a/crates/export/src/lib.rs +++ b/crates/export/src/lib.rs @@ -413,9 +413,16 @@ fn write_still(cx: &Cx, file: &mut W, img: &I }; match fmt { OutputFormat::PngSequence => image::codecs::png::PngEncoder::new(file).write_image(&data, w, h, ct), - // Uncompressed (the encoder's run-length compression is off), top-left origin, the - // alpha bits in the image descriptor: 8 for RGB + Alpha, 0 otherwise. - OutputFormat::TargaSequence => image::codecs::tga::TgaEncoder::new(file).disable_rle().write_image(&data, w, h, ct), + // The shared footerless writer: uncompressed, top-left origin, the alpha bits in the + // image descriptor: 8 for RGB + Alpha, 0 otherwise. + OutputFormat::TargaSequence => { + let layout = match channels { + Channels::Rgba => craft_tga::Layout::Rgba, + Channels::Alpha => craft_tga::Layout::Gray, + Channels::Rgb => craft_tga::Layout::Rgb, + }; + return craft_tga::write_top_left_raw(file, w, h, layout, &data).map_err(|e| ExportError::Encode(e.to_string())); + } // (the TIFF encoder needs Seek) _ => image::codecs::tiff::TiffEncoder::new(file).write_image(&data, w, h, ct), }