SixLabors/ImageSharp · error · NotSupportedException

ccitt extensions 2D codes are not supported.

Error message

ccitt extensions 2D codes are not supported.

What it means

Analogous to the 1D case: the T6 bit reader hit a 2D coding-extension codeword while decoding CCITT Group 4 data. After re-reading 5 bits to confirm it was not an EOL, the decoder throws NotSupportedException because extension 2D codes are not implemented.

Solutions

  1. Re-encode the image to standard G4 without extensions using libtiff or ImageMagick, then load again.
  2. Verify the file is not truncated — corruption can masquerade as extension codes.
  3. Catch NotSupportedException and route to a fallback decoder (e.g. System.Drawing/Magick.NET) for such files.
Defensive patterns

Strategy: fallback

Try / catch

try { using var img = Image.Load(path); }
catch (NotSupportedException)
{
    // fall back to a libtiff-based decoder or re-encode the file
}

Prevention

When it happens

Trigger: Decoding a CcittGroup4 TIFF stream that contains 2D extension codewords (reserved prefixes), either from an encoder using CCITT extensions or from bitstream misalignment due to corruption.

Common situations: Legacy fax files with extended coding modes; truncated/corrupt G4 data causing the reader to interpret filler bits as extension codes.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of SixLabors/ImageSharp@59ce6af6fc (2026-09-13). Data as JSON: /api/errors/18e09b6556f3d588. Report an issue: GitHub.

Appendix: source

Thrown at src/ImageSharp/Formats/Tiff/Compression/Decompressors/T6BitReader.cs:150

                        if (this.ReadValue(5) == 1)
                        {
                            return true;
                        }

                        throw new NotSupportedException("ccitt extensions 1D codes are not supported.");
                    }

                    if (value == Len7Code0000001.Code)
                    {
                        this.Code = Len7Code0000001;

                        // Same as above, we do not support Extensions2D codes, but it could be a EOL instead.
                        if (this.ReadValue(5) == 1)
                        {
                            return true;
                        }

                        throw new NotSupportedException("ccitt extensions 2D codes are not supported.");
                    }

                    if (value == Len7Code0000011.Code)
                    {
                        this.Code = Len7Code0000011;
                        return false;
                    }

                    if (value == Len7Code0000010.Code)
                    {
                        this.Code = Len7Code0000010;
                        return false;
                    }

                    break;
            }

            uint currBit = this.ReadValue(1);

View on GitHub (pinned to 59ce6af6fc)