{"record":{"id":"79c2c5765b6ceab8","repo":"SixLabors/ImageSharp","slug":"ccitt-extensions-1d-codes-are-not-supported","errorCode":null,"errorMessage":"ccitt extensions 1D codes are not supported.","messagePattern":"ccitt extensions 1D codes are not supported\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/ImageSharp/Formats/Tiff/Compression/Decompressors/T6BitReader.cs","lineNumber":137,"sourceCode":"                        return false;\n                    }\n\n                    break;\n\n                case 7:\n                    if (value == Len7Code0000000.Code)\n                    {\n                        this.Code = Len7Code0000000;\n\n                        // We do not support Extensions1D codes, but some encoders (scanner from epson) write a premature EOL code,\n                        // which at this point cannot be distinguished from the marker, because we read the data bit by bit.\n                        // Read the next 5 bit, if its a EOL code return true, indicating its the end of the image.\n                        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;","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/SixLabors/ImageSharp/blob/59ce6af6fc29027cda277ef62d4d1694a8acce91/src/ImageSharp/Formats/Tiff/Compression/Decompressors/T6BitReader.cs#L119-L155","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-encode the source image with plain G4 (no extensions) using another tool (e.g. libtiff's tiffcp) before loading.","If the file is 1D G3-encoded, open it as CcittGroup3 instead of Group4.","Catch NotSupportedException and fall back to another decoder or inform the user the TIFF uses unsupported CCITT extensions."],"exampleFix":"// before\nusing var image = Image.Load(path); // throws on G4 extensions\n// after\ntry { using var image = Image.Load(path); }\ncatch (NotSupportedException) { /* re-encode externally or use a different codec */ }","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { using var img = Image.Load(path); }\ncatch (NotSupportedException)\n{\n    // convert with libtiff: tiffcp -c g4 src.tif dst.tif, then retry\n}","preventionTips":["Pre-normalize third-party TIFFs with tiffcp/tiffinfo before loading","Verify file integrity — bitstream corruption can surface as extension codes","Log the compression tag value to diagnose G3-vs-G4 mismatches"],"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"}