Subject: remove HAVE_EXACT_CMYK8 From: Johannes Schauer Marin Rodrigues --- a/src/img2pdf_test.py +++ b/src/img2pdf_test.py @@ -85,7 +85,6 @@ for prog in ["convert", "compare", "iden globals()[prog.upper()] = ["magick", prog] HAVE_IMAGEMAGICK_MODERN = True -HAVE_EXACT_CMYK8 = True try: ver = subprocess.check_output(CONVERT + ["-version"], stderr=subprocess.STDOUT) m = re.fullmatch( @@ -93,18 +92,13 @@ try: ) if m is None: HAVE_IMAGEMAGICK_MODERN = False - HAVE_EXACT_CMYK8 = False else: if parse_version(m.group(1)) < parse_version("6.9.10-12"): HAVE_IMAGEMAGICK_MODERN = False - if parse_version(m.group(1)) < parse_version("7.1.0-48"): - HAVE_EXACT_CMYK8 = False except FileNotFoundError: HAVE_IMAGEMAGICK_MODERN = False - HAVE_EXACT_CMYK8 = False except subprocess.CalledProcessError: HAVE_IMAGEMAGICK_MODERN = False - HAVE_EXACT_CMYK8 = False if not HAVE_IMAGEMAGICK_MODERN: warnings.warn("imagemagick >= 6.9.10-12 not available, skipping certain checks...") @@ -351,9 +345,7 @@ def write_png(data, path, bitdepth, colo def compare(im1, im2, exact, icc, cmyk): if exact: - if cmyk and not HAVE_EXACT_CMYK8: - raise Exception("cmyk cannot be exact before ImageMagick 7.1.0-48") - elif icc: + if icc: raise Exception("icc cannot be exact") else: subprocess.check_call( @@ -5562,11 +5554,9 @@ def test_jpg_rot(tmp_path_factory, jpg_r ) def test_jpg_cmyk(tmp_path_factory, jpg_cmyk_img, jpg_cmyk_pdf): tmpdir = tmp_path_factory.mktemp("jpg_cmyk") - compare_ghostscript( - tmpdir, jpg_cmyk_img, jpg_cmyk_pdf, gsdevice="tiff32nc", exact=HAVE_EXACT_CMYK8 - ) + compare_ghostscript(tmpdir, jpg_cmyk_img, jpg_cmyk_pdf, gsdevice="tiff32nc") # not testing with poppler as it cannot write CMYK images - compare_mupdf(tmpdir, jpg_cmyk_img, jpg_cmyk_pdf, exact=HAVE_EXACT_CMYK8, cmyk=True) + compare_mupdf(tmpdir, jpg_cmyk_img, jpg_cmyk_pdf, cmyk=True) compare_pdfimages_cmyk(tmpdir, jpg_cmyk_img, jpg_cmyk_pdf) @@ -5957,12 +5947,9 @@ def test_tiff_cmyk8(tmp_path_factory, ti tiff_cmyk8_img, tiff_cmyk8_pdf, gsdevice="tiff32nc", - exact=HAVE_EXACT_CMYK8, ) # not testing with poppler as it cannot write CMYK images - compare_mupdf( - tmpdir, tiff_cmyk8_img, tiff_cmyk8_pdf, exact=HAVE_EXACT_CMYK8, cmyk=True - ) + compare_mupdf(tmpdir, tiff_cmyk8_img, tiff_cmyk8_pdf, cmyk=True) compare_pdfimages_tiff(tmpdir, tiff_cmyk8_img, tiff_cmyk8_pdf) @@ -6403,11 +6390,9 @@ def test_tiff_ccitt_nometa2( ) def test_miff_cmyk8(tmp_path_factory, miff_cmyk8_img, tiff_cmyk8_img, miff_cmyk8_pdf): tmpdir = tmp_path_factory.mktemp("miff_cmyk8") - compare_ghostscript( - tmpdir, tiff_cmyk8_img, miff_cmyk8_pdf, gsdevice="tiff32nc", exact=False - ) + compare_ghostscript(tmpdir, tiff_cmyk8_img, miff_cmyk8_pdf, gsdevice="tiff32nc") # not testing with poppler as it cannot write CMYK images - compare_mupdf(tmpdir, tiff_cmyk8_img, miff_cmyk8_pdf, exact=False, cmyk=True) + compare_mupdf(tmpdir, tiff_cmyk8_img, miff_cmyk8_pdf, cmyk=True) compare_pdfimages_tiff(tmpdir, tiff_cmyk8_img, miff_cmyk8_pdf)