SixLabors/ImageSharp · error · NotSupportedException

ccitt extensions 1D codes are not supported.

Error message

ccitt extensions 1D codes are not supported.

What it means

While decoding CCITT Group 4 (T6) data, the bit reader encountered a prefix code reserved for '1D coding extensions' (CCITT extension codes). These extended 1D codes are not implemented by the decoder, so it throws NotSupportedException after first checking whether the sequence was actually an EOL marker.

Solutions

  1. Re-encode the source image with plain G4 (no extensions) using another tool (e.g. libtiff's tiffcp) before loading.
  2. If the file is 1D G3-encoded, open it as CcittGroup3 instead of Group4.
  3. Catch NotSupportedException and fall back to another decoder or inform the user the TIFF uses unsupported CCITT extensions.

Example fix

// before
using var image = Image.Load(path); // throws on G4 extensions
// after
try { using var image = Image.Load(path); }
catch (NotSupportedException) { /* re-encode externally or use a different codec */ }
Defensive patterns

Strategy: fallback

Try / catch

try { using var img = Image.Load(path); }
catch (NotSupportedException)
{
    // convert with libtiff: tiffcp -c g4 src.tif dst.tif, then retry
}

Prevention

When it happens

Trigger: Decoding a TiffCompression.CcittGroup4 image whose stream contains 1D extension codewords, typically because the file was encoded with CCITT extensions or belongs to a modem/fax standard variant using extended coding modes.

Common situations: Opening legacy fax-derived TIFFs or files produced by encoders that emit extension codes; also seen when a corrupt bitstream causes the reader to misalign and land on a reserved prefix.

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/79c2c5765b6ceab8. Report an issue: GitHub.

Appendix: source

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

                        return false;
                    }

                    break;

                case 7:
                    if (value == Len7Code0000000.Code)
                    {
                        this.Code = Len7Code0000000;

                        // We do not support Extensions1D codes, but some encoders (scanner from epson) write a premature EOL code,
                        // which at this point cannot be distinguished from the marker, because we read the data bit by bit.
                        // Read the next 5 bit, if its a EOL code return true, indicating its the end of the image.
                        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;

View on GitHub (pinned to 59ce6af6fc)