File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import pymupdf
22import os
3+ import util
4+
35
46scriptdir = os .path .dirname (__file__ )
57
@@ -13,3 +15,25 @@ def test_rewrite_images():
1315 data = doc .tobytes (garbage = 3 , deflate = True )
1416 size1 = len (data )
1517 assert (1 - (size1 / size0 )) > 0.3
18+
19+
20+ def test_4918 ():
21+ '''
22+ By default this test does nothing, because it requires a rather large input document from:
23+ https://drive.google.com/file/d/1OkIq3XJuKiFfKDWBIcAk8_fLLjpNkuHQ/view?usp=sharing
24+
25+ It's non-trivial to download from this url, so we only do anything if
26+ environment variable PYMUPDF_TEST_4918_PATH is set to local path of the
27+ input document.
28+
29+ As of 2026-06-04 this passes with mupdf master, but segvs with current
30+ pymupdf release 1.27.2.3.
31+ '''
32+ PYMUPDF_TEST_4918_PATH = os .environ .get ('PYMUPDF_TEST_4918_PATH' )
33+ if not PYMUPDF_TEST_4918_PATH :
34+ print (f'test_4918(): Doing nothing because { PYMUPDF_TEST_4918_PATH = } .' )
35+ return
36+ path = PYMUPDF_TEST_4918_PATH
37+ print (f'{ path = } ' )
38+ with pymupdf .open (path ) as document :
39+ document .rewrite_images (dpi_threshold = 150 , dpi_target = 100 , quality = 50 )
You can’t perform that action at this time.
0 commit comments