How GIMP Processes DDS Textures with BC7 Compression

This article explains how the GNU Image Manipulation Program (GIMP) handles DirectDraw Surface (DDS) files utilizing BC7 block compression for game development pipelines. It covers the full lifecycle of a texture within the software, from decoding compressed 4x4 pixel blocks upon import to color-space handling, mipmap generation, and final encoding via the DX10 header format required by modern game engines.

Understanding DDS and BC7 Compression

DirectDraw Surface (DDS) is a container format designed to store data directly consumable by graphic processing units (GPUs). Within game development, the BC7 (Block Compression 7) algorithm—standardized in DirectX 11 under DXGI_FORMAT_BC7_UNORM and DXGI_FORMAT_BC7_UNORM_SRGB—is the industry standard for high-quality RGB and RGBA textures. It uses 16-byte blocks to represent 4x4 pixel grids, providing a fixed compression ratio of 1 byte per pixel (8 bits per pixel) while significantly reducing block artifacts compared to older algorithms like DXT1 (BC1) or DXT5 (BC5).

Import and Decompression in GIMP

Beginning with GIMP 2.10, DDS support is integrated natively into the core application without requiring third-party plugins. When a user opens a BC7-encoded DDS file, GIMP processes the file through the following steps:

  1. Header Parsing: GIMP reads the standard DDS_HEADER and detects the DX10 extended header (DDS_HEADER_DXT10), which specifies the exact DXGI format used.
  2. Block Decoding: GIMP's internal decoder unpacks the 128-bit BC7 blocks into uncompressed, 8-bit or 32-bit floating-point RGBA pixel arrays in RAM.
  3. Mipmap Stripping: By default, GIMP reads the base full-resolution texture surface into an editable layer. If configured to load mipmaps, each downscaled level is loaded as an individual layer within the image stack.

Image Manipulation and Color Space Management

Once decoded, the texture loses its hardware-level compression and behaves like any standard raster image within GIMP’s GEGL (Generic Graphical Library) pipeline.

Because BC7 can store both linear data (such as normal maps, roughness, and metalness maps) and sRGB data (such as albedo or diffuse textures), color space management is critical:

  • Albedo/Color Maps: Edited in standard sRGB space to ensure accurate color perception during the creative process.
  • Data/PBR Maps: Handled in non-color or linear gamma space to prevent GEGL from applying automatic gamma corrections that distort numerical data used by shader calculations.

Exporting and BC7 Encoding for Game Engines

When exporting to DDS, GIMP reverses the decompression process through an integrated encoding library. The workflow for saving a BC7 DDS texture involves specific configuration options:

  1. Format Selection: In the DDS export dialog, the user sets the compression algorithm to BC7 / DX10. This ensures the resulting file contains the appropriate extended header for engine compatibility.
  2. Color Profile Tagging: Users choose between standard linear (UNORM) or sRGB formats. Game engines such as Unreal Engine and Unity read this metadata to determine whether the GPU should automatically perform sRGB-to-linear conversion in hardware during texture sampling.
  3. Mipmap Generation: GIMP provides options to automatically generate mipmaps during export. The software filters the primary image down to 1x1 pixel representations using algorithms like Box, Lanczos, or Kaiser filtering. These lower-resolution surfaces are packed directly into the final DDS file structure sequentially after the primary surface.
  4. Block Fitting and Partitioning: The encoder evaluates each 4x4 block of the edited image, testing various BC7 partition modes and endpoint pairs to approximate the original colors with minimal mathematical error.

Once encoded, the output file can be imported directly into engines like Unreal Engine, Unity, or Godot without requiring secondary compression passes, preserving the exact visual fidelity and channel layouts defined inside GIMP.