Skip to content

[Bug]: Color channel swap (RGB/BGR) when decoding specific BLP1 files #54

Description

@supemeko

Prerequisites

  • I have searched existing issues to ensure this isn't a duplicate
  • I am using the latest version or main branch

Bug Description

I am observing a color channel discrepancy when decoding certain BLP1 files using wow_blp.

In the specific case of yellowaura.blp (attached), the texture appears Yellow when rendered within the Warcraft III game engine. However, when decoded using wow_blp::convert::blp_to_image, the resulting output is Cyan.

If I manually swap the Red and Blue channels of the decoded buffer in my code, the output correctly becomes Yellow, matching the in-game appearance.

Expected Behavior

I expected blp_to_image to output a Yellow image for yellowaura.blp, consistent with its appearance in Warcraft III. However, the current output is Cyan, suggesting the Red and Blue channels might be swapped during the decoding of this specific BLP1 file.

Steps to Reproduce

use image::{ImageBuffer, Rgba};
use wow_blp::convert::blp_to_image;
use wow_blp::parser::load_blp;

pub fn main() {
    let blp_file = load_blp("data/archives/yellowaura.blp").unwrap();

    let image = blp_to_image(&blp_file, 0).unwrap();

    image.save("data/output/output.png").unwrap();

    let mut flip_rgb_image: ImageBuffer<Rgba<u8>, Vec<u8>> = image.clone().into();
    for pixel in flip_rgb_image.pixels_mut() {
        let Rgba([r, g, b, a]) = *pixel;
        *pixel = Rgba([b, g, r, a]); 
    }

    flip_rgb_image.save("data/output/flip_rgb_image.png");
}

Version

0.3.2

Rust Toolchain

rustc 1.89.0 (29483883e 2025-08-04)

Operating System

Linux

Cargo Output

Backtrace

Additional Context

Supporting Files

I have attached a ZIP archive containing:

  1. yellowaura.blp: The original source file.
  2. output.png: The direct output from wow_blp.
  3. flip_rgb_image.png: The output after I manually performed an in-place R/B channel swap.

yellowaura.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageThis fine issue will need some housekeeping before it can be processed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions