Skip to content

Commit 49d8fe4

Browse files
j-t-1OpenNingia
authored andcommitted
MAINT: Increase readability in CCITTFaxDecode (py-pdf#3416)
params.group is not always equal to 4, so the comment is changed.
1 parent c7a9fc2 commit 49d8fe4

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

pypdf/filters.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -631,44 +631,44 @@ def decode(
631631
tiff_header = struct.pack(
632632
tiff_header_struct,
633633
b"II", # Byte order indication: Little endian
634-
42, # Version number (always 42)
635-
8, # Offset to first IFD
636-
8, # Number of tags in IFD
637-
256,
634+
42, # Version number (always 42)
635+
8, # Offset to the first image file directory (IFD)
636+
8, # Number of tags in IFD
637+
256, # ImageWidth, LONG, 1, width
638638
4,
639639
1,
640-
params.columns, # ImageWidth, LONG, 1, width
641-
257,
640+
params.columns,
641+
257, # ImageLength, LONG, 1, length
642642
4,
643643
1,
644-
params.rows, # ImageLength, LONG, 1, length
645-
258,
644+
params.rows,
645+
258, # BitsPerSample, SHORT, 1, 1
646646
3,
647647
1,
648-
1, # BitsPerSample, SHORT, 1, 1
649-
259,
648+
1,
649+
259, # Compression, SHORT, 1, compression Type
650650
3,
651651
1,
652-
params.group, # Compression, SHORT, 1, 4 = CCITT Group 4 fax encoding
653-
262,
652+
params.group,
653+
262, # Thresholding, SHORT, 1, 0 = BlackIs1
654654
3,
655655
1,
656-
0, # Thresholding, SHORT, 1, 0 = WhiteIsZero
657-
273,
656+
0,
657+
273, # StripOffsets, LONG, 1, length of header
658658
4,
659659
1,
660-
struct.calcsize(
660+
struct.calcsize(
661661
tiff_header_struct
662-
), # StripOffsets, LONG, 1, length of header
663-
278,
662+
),
663+
278, # RowsPerStrip, LONG, 1, length
664664
4,
665665
1,
666-
params.rows, # RowsPerStrip, LONG, 1, length
667-
279,
666+
params.rows,
667+
279, # StripByteCounts, LONG, 1, size of image
668668
4,
669669
1,
670-
img_size, # StripByteCounts, LONG, 1, size of image
671-
0, # last IFD
670+
img_size,
671+
0, # last IFD
672672
)
673673

674674
return tiff_header + data

0 commit comments

Comments
 (0)