File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 104104 url : https://github.com/py-pdf/pypdf/assets/4083478/56c93021-33cd-4387-ae13-5cbe7e673f42
105105- local_filename : paid.pdf
106106 url : https://github.com/py-pdf/pypdf/files/12050253/tt.pdf
107+ - local_filename : 4bits_image.pdf
108+ url : https://github.com/user-attachments/files/27491104/test_4bit.pdf
107109- local_filename : Pesquisa-de-Precos-Combustiveis-novembro-2023.pdf
108110 url : https://www.joinville.sc.gov.br/wp-content/uploads/2023/11/Pesquisa-de-Precos-Combustiveis-novembro-2023.pdf
109111- local_filename : iss2138.pdf
Original file line number Diff line number Diff line change @@ -485,7 +485,7 @@ def test_index_lookup():
485485
486486@pytest .mark .enable_socket
487487def test_2bits_image ():
488- """From #1954, test with 2bits image. TODO: 4bits also """
488+ """From #1954, test with 2bits image."""
489489 reader = PdfReader (BytesIO (get_data_from_url (name = "paid.pdf" )))
490490 url_png = "https://user-images.githubusercontent.com/4083478/253568117-ca95cc85-9dea-4145-a5e0-032f1c1aa322.png"
491491 name_png = "Paid.png"
@@ -494,6 +494,17 @@ def test_2bits_image():
494494 assert image_similarity (data .image , refimg ) > 0.99
495495
496496
497+ @pytest .mark .enable_socket
498+ def test_4bits_image ():
499+ """From #1954, test with 4bits image."""
500+ reader = PdfReader (BytesIO (get_data_from_url (name = "4bits_image.pdf" )))
501+ url_png = "https://github.com/user-attachments/files/27492549/4bits_image.png.txt"
502+ name_png = "4bits_image.png"
503+ refimg = BytesIO (get_data_from_url (url = url_png , name = name_png ))
504+ data = reader .pages [0 ].images [0 ]
505+ assert image_similarity (data .image , refimg ) > 0.99
506+
507+
497508@pytest .mark .enable_socket
498509def test_gray_devicen_cmyk ():
499510 """
You can’t perform that action at this time.
0 commit comments