{"record":{"id":"18e09b6556f3d588","repo":"SixLabors/ImageSharp","slug":"ccitt-extensions-2d-codes-are-not-supported","errorCode":null,"errorMessage":"ccitt extensions 2D codes are not supported.","messagePattern":"ccitt extensions 2D codes are not supported\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/ImageSharp/Formats/Tiff/Compression/Decompressors/T6BitReader.cs","lineNumber":150,"sourceCode":"                        if (this.ReadValue(5) == 1)\n                        {\n                            return true;\n                        }\n\n                        throw new NotSupportedException(\"ccitt extensions 1D codes are not supported.\");\n                    }\n\n                    if (value == Len7Code0000001.Code)\n                    {\n                        this.Code = Len7Code0000001;\n\n                        // Same as above, we do not support Extensions2D codes, but it could be a EOL instead.\n                        if (this.ReadValue(5) == 1)\n                        {\n                            return true;\n                        }\n\n                        throw new NotSupportedException(\"ccitt extensions 2D codes are not supported.\");\n                    }\n\n                    if (value == Len7Code0000011.Code)\n                    {\n                        this.Code = Len7Code0000011;\n                        return false;\n                    }\n\n                    if (value == Len7Code0000010.Code)\n                    {\n                        this.Code = Len7Code0000010;\n                        return false;\n                    }\n\n                    break;\n            }\n\n            uint currBit = this.ReadValue(1);","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/SixLabors/ImageSharp/blob/59ce6af6fc29027cda277ef62d4d1694a8acce91/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T6BitReader.cs#L132-L168","documentation":"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.","triggerScenarios":"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.","commonSituations":"Legacy fax files with extended coding modes; truncated/corrupt G4 data causing the reader to interpret filler bits as extension codes.","solutions":["Re-encode the image to standard G4 without extensions using libtiff or ImageMagick, then load again.","Verify the file is not truncated — corruption can masquerade as extension codes.","Catch NotSupportedException and route to a fallback decoder (e.g. System.Drawing/Magick.NET) for such files."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { using var img = Image.Load(path); }\ncatch (NotSupportedException)\n{\n    // fall back to a libtiff-based decoder or re-encode the file\n}","preventionTips":["Re-encode unusual fax-derived G4 files to standard G4 before processing","Check for truncation (file size vs strip byte counts) before decode","Keep a secondary decoder available for legacy fax formats"],"tags":["tiff","ccitt","group4","decoding","unsupported"],"backgroundTag":"unsupported-operation","analyzedSha":"59ce6af6fc29027cda277ef62d4d1694a8acce91","analyzedAt":"2026-09-13T18:34:59.331Z","contentChangedAt":"2026-09-13T18:34:59.331Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}