Skip to content

DDS pictures inside other files still come out with red and blue swapped #741

Closed

Description

@SeoJCalive

Follow-up to #627, as asked there.

#627 fixed the red/blue swap for DDS files converted on their own (and the crop window): after ImageMagick reads the file, DdsChannelOrder.Correct swaps the channels back for the R8G8B8A8 layout. A DDS that is part of another file is opened with MagickImage directly and still comes out swapped:

  1. E-books, Markdown and HWP pictures: EbookFiles.CommonImage converts pictures that aren't JPEG/PNG/GIF/SVG to PNG or JPEG. A DDS goes through there unchanged.
  2. DOCX and HWPX output: DocxWriter and HwpxWriter turn pictures Word or Hancom can't show into PNG.
  3. 3D model textures: TextureForGltf converts textures to PNG for glTF/GLB. Game models often use DDS textures, so this is the case most likely to show up.

The fix is to call DdsChannelOrder.Correct in these places. The texture is read from bytes, not from a file, so DdsChannelOrder gets an overload that checks the header from the bytes. Each path gets a test with a small R8G8B8A8 DDS that checks the colours come out right.

I'm starting on it now.

Activity

  1. self-assigned this
    on Oct 29, 2026
  2. added a commit that references this issue on Oct 29, 2026
    9985dc3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions