Convert 8-bit PNG & GIF alpha channels to /SMasks in PDF #106

Merged
josch merged 7 commits from tzahola/img2pdf:png-alpha-to-smask into main 2021-08-22 08:08:26 +00:00
Showing only changes of commit 968fc0c27a - Show all commits

View file

@ -2287,7 +2287,15 @@ def tiff_float_img(tmp_path_factory, tmp_normal_png):
def tiff_cmyk8_img(tmp_path_factory, tmp_normal_png): def tiff_cmyk8_img(tmp_path_factory, tmp_normal_png):
in_img = tmp_path_factory.mktemp("tiff_cmyk8") / "in.tiff" in_img = tmp_path_factory.mktemp("tiff_cmyk8") / "in.tiff"
subprocess.check_call( subprocess.check_call(
["convert", str(tmp_normal_png), "-colorspace", "cmyk", str(in_img)] [
"convert",
str(tmp_normal_png),
"-colorspace",
"cmyk",
"-compress",
"Zip",
str(in_img)
]
) )
identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"])) identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"]))
assert len(identify) == 1 assert len(identify) == 1
@ -2344,6 +2352,8 @@ def tiff_cmyk16_img(tmp_path_factory, tmp_normal_png):
"16", "16",
"-colorspace", "-colorspace",
"cmyk", "cmyk",
"-compress",
"Zip",
str(in_img), str(in_img),
] ]
) )
@ -2394,7 +2404,15 @@ def tiff_cmyk16_img(tmp_path_factory, tmp_normal_png):
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def tiff_rgb8_img(tmp_path_factory, tmp_normal_png): def tiff_rgb8_img(tmp_path_factory, tmp_normal_png):
in_img = tmp_path_factory.mktemp("tiff_rgb8") / "in.tiff" in_img = tmp_path_factory.mktemp("tiff_rgb8") / "in.tiff"
subprocess.check_call(["convert", str(tmp_normal_png), str(in_img)]) subprocess.check_call(
[
"convert",
str(tmp_normal_png),
"-compress",
"Zip",
str(in_img)
]
)
identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"])) identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"]))
assert len(identify) == 1 assert len(identify) == 1
# somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was # somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was
@ -2442,7 +2460,15 @@ def tiff_rgb8_img(tmp_path_factory, tmp_normal_png):
def tiff_rgb12_img(tmp_path_factory, tmp_normal16_png): def tiff_rgb12_img(tmp_path_factory, tmp_normal16_png):
in_img = tmp_path_factory.mktemp("tiff_rgb8") / "in.tiff" in_img = tmp_path_factory.mktemp("tiff_rgb8") / "in.tiff"
subprocess.check_call( subprocess.check_call(
["convert", str(tmp_normal16_png), "-depth", "12", str(in_img)] [
"convert",
str(tmp_normal16_png),
"-depth",
"12",
"-compress",
"Zip",
str(in_img)
]
) )
identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"])) identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"]))
assert len(identify) == 1 assert len(identify) == 1
@ -2495,7 +2521,15 @@ def tiff_rgb12_img(tmp_path_factory, tmp_normal16_png):
def tiff_rgb14_img(tmp_path_factory, tmp_normal16_png): def tiff_rgb14_img(tmp_path_factory, tmp_normal16_png):
in_img = tmp_path_factory.mktemp("tiff_rgb8") / "in.tiff" in_img = tmp_path_factory.mktemp("tiff_rgb8") / "in.tiff"
subprocess.check_call( subprocess.check_call(
["convert", str(tmp_normal16_png), "-depth", "14", str(in_img)] [
"convert",
str(tmp_normal16_png),
"-depth",
"14",
"-compress",
"Zip",
str(in_img)
]
) )
identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"])) identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"]))
assert len(identify) == 1 assert len(identify) == 1
@ -2548,7 +2582,15 @@ def tiff_rgb14_img(tmp_path_factory, tmp_normal16_png):
def tiff_rgb16_img(tmp_path_factory, tmp_normal16_png): def tiff_rgb16_img(tmp_path_factory, tmp_normal16_png):
in_img = tmp_path_factory.mktemp("tiff_rgb8") / "in.tiff" in_img = tmp_path_factory.mktemp("tiff_rgb8") / "in.tiff"
subprocess.check_call( subprocess.check_call(
["convert", str(tmp_normal16_png), "-depth", "16", str(in_img)] [
"convert",
str(tmp_normal16_png),
"-depth",
"16",
"-compress",
"Zip",
str(in_img)
]
) )
identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"])) identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"]))
assert len(identify) == 1 assert len(identify) == 1
@ -2597,7 +2639,16 @@ def tiff_rgb16_img(tmp_path_factory, tmp_normal16_png):
def tiff_rgba8_img(tmp_path_factory, tmp_alpha_png): def tiff_rgba8_img(tmp_path_factory, tmp_alpha_png):
in_img = tmp_path_factory.mktemp("tiff_rgba8") / "in.tiff" in_img = tmp_path_factory.mktemp("tiff_rgba8") / "in.tiff"
subprocess.check_call( subprocess.check_call(
["convert", str(tmp_alpha_png), "-depth", "8", "-strip", str(in_img)] [
"convert",
str(tmp_alpha_png),
"-depth",
"8",
"-strip",
"-compress",
"Zip",
str(in_img)
]
) )
identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"])) identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"]))
assert len(identify) == 1 assert len(identify) == 1
@ -2646,7 +2697,16 @@ def tiff_rgba8_img(tmp_path_factory, tmp_alpha_png):
def tiff_rgba16_img(tmp_path_factory, tmp_alpha_png): def tiff_rgba16_img(tmp_path_factory, tmp_alpha_png):
in_img = tmp_path_factory.mktemp("tiff_rgba16") / "in.tiff" in_img = tmp_path_factory.mktemp("tiff_rgba16") / "in.tiff"
subprocess.check_call( subprocess.check_call(
["convert", str(tmp_alpha_png), "-depth", "16", "-strip", str(in_img)] [
"convert",
str(tmp_alpha_png),
"-depth",
"16",
"-strip",
"-compress",
"Zip",
str(in_img)
]
) )
identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"])) identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"]))
assert len(identify) == 1 assert len(identify) == 1
@ -2694,7 +2754,17 @@ def tiff_rgba16_img(tmp_path_factory, tmp_alpha_png):
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def tiff_gray1_img(tmp_path_factory, tmp_gray1_png): def tiff_gray1_img(tmp_path_factory, tmp_gray1_png):
in_img = tmp_path_factory.mktemp("tiff_gray1") / "in.tiff" in_img = tmp_path_factory.mktemp("tiff_gray1") / "in.tiff"
subprocess.check_call(["convert", str(tmp_gray1_png), "-depth", "1", str(in_img)]) subprocess.check_call(
[
"convert",
str(tmp_gray1_png),
"-depth",
"1",
"-compress",
"Zip",
str(in_img)
]
)
identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"])) identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"]))
assert len(identify) == 1 assert len(identify) == 1
# somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was # somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was
@ -2742,7 +2812,17 @@ def tiff_gray1_img(tmp_path_factory, tmp_gray1_png):
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def tiff_gray2_img(tmp_path_factory, tmp_gray2_png): def tiff_gray2_img(tmp_path_factory, tmp_gray2_png):
in_img = tmp_path_factory.mktemp("tiff_gray2") / "in.tiff" in_img = tmp_path_factory.mktemp("tiff_gray2") / "in.tiff"
subprocess.check_call(["convert", str(tmp_gray2_png), "-depth", "2", str(in_img)]) subprocess.check_call(
[
"convert",
str(tmp_gray2_png),
"-depth",
"2",
"-compress",
"Zip",
str(in_img)
]
)
identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"])) identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"]))
assert len(identify) == 1 assert len(identify) == 1
# somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was # somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was
@ -2790,7 +2870,17 @@ def tiff_gray2_img(tmp_path_factory, tmp_gray2_png):
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def tiff_gray4_img(tmp_path_factory, tmp_gray4_png): def tiff_gray4_img(tmp_path_factory, tmp_gray4_png):
in_img = tmp_path_factory.mktemp("tiff_gray4") / "in.tiff" in_img = tmp_path_factory.mktemp("tiff_gray4") / "in.tiff"
subprocess.check_call(["convert", str(tmp_gray4_png), "-depth", "4", str(in_img)]) subprocess.check_call(
[
"convert",
str(tmp_gray4_png),
"-depth",
"4",
"-compress",
"Zip",
str(in_img)
]
)
identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"])) identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"]))
assert len(identify) == 1 assert len(identify) == 1
# somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was # somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was
@ -2838,7 +2928,17 @@ def tiff_gray4_img(tmp_path_factory, tmp_gray4_png):
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def tiff_gray8_img(tmp_path_factory, tmp_gray8_png): def tiff_gray8_img(tmp_path_factory, tmp_gray8_png):
in_img = tmp_path_factory.mktemp("tiff_gray8") / "in.tiff" in_img = tmp_path_factory.mktemp("tiff_gray8") / "in.tiff"
subprocess.check_call(["convert", str(tmp_gray8_png), "-depth", "8", str(in_img)]) subprocess.check_call(
[
"convert",
str(tmp_gray8_png),
"-depth",
"8",
"-compress",
"Zip",
str(in_img)
]
)
identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"])) identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"]))
assert len(identify) == 1 assert len(identify) == 1
# somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was # somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was
@ -2886,7 +2986,17 @@ def tiff_gray8_img(tmp_path_factory, tmp_gray8_png):
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def tiff_gray16_img(tmp_path_factory, tmp_gray16_png): def tiff_gray16_img(tmp_path_factory, tmp_gray16_png):
in_img = tmp_path_factory.mktemp("tiff_gray16") / "in.tiff" in_img = tmp_path_factory.mktemp("tiff_gray16") / "in.tiff"
subprocess.check_call(["convert", str(tmp_gray16_png), "-depth", "16", str(in_img)]) subprocess.check_call(
[
"convert",
str(tmp_gray16_png),
"-depth",
"16",
"-compress",
"Zip",
str(in_img)
]
)
identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"])) identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"]))
assert len(identify) == 1 assert len(identify) == 1
# somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was # somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was
@ -2935,7 +3045,15 @@ def tiff_gray16_img(tmp_path_factory, tmp_gray16_png):
def tiff_multipage_img(tmp_path_factory, tmp_normal_png, tmp_inverse_png): def tiff_multipage_img(tmp_path_factory, tmp_normal_png, tmp_inverse_png):
in_img = tmp_path_factory.mktemp("tiff_multipage_img") / "in.tiff" in_img = tmp_path_factory.mktemp("tiff_multipage_img") / "in.tiff"
subprocess.check_call( subprocess.check_call(
["convert", str(tmp_normal_png), str(tmp_inverse_png), "-strip", str(in_img)] [
"convert",
str(tmp_normal_png),
str(tmp_inverse_png),
"-strip",
"-compress",
"Zip",
str(in_img)
]
) )
identify = json.loads( identify = json.loads(
subprocess.check_output(["convert", str(in_img) + "[0]", "json:"]) subprocess.check_output(["convert", str(in_img) + "[0]", "json:"])
@ -3027,7 +3145,15 @@ def tiff_multipage_img(tmp_path_factory, tmp_normal_png, tmp_inverse_png):
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def tiff_palette1_img(tmp_path_factory, tmp_palette1_png): def tiff_palette1_img(tmp_path_factory, tmp_palette1_png):
in_img = tmp_path_factory.mktemp("tiff_palette1_img") / "in.tiff" in_img = tmp_path_factory.mktemp("tiff_palette1_img") / "in.tiff"
subprocess.check_call(["convert", str(tmp_palette1_png), str(in_img)]) subprocess.check_call(
[
"convert",
str(tmp_palette1_png),
"-compress",
"Zip",
str(in_img)
]
)
identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"])) identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"]))
assert len(identify) == 1 assert len(identify) == 1
# somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was # somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was
@ -3076,7 +3202,15 @@ def tiff_palette1_img(tmp_path_factory, tmp_palette1_png):
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def tiff_palette2_img(tmp_path_factory, tmp_palette2_png): def tiff_palette2_img(tmp_path_factory, tmp_palette2_png):
in_img = tmp_path_factory.mktemp("tiff_palette2_img") / "in.tiff" in_img = tmp_path_factory.mktemp("tiff_palette2_img") / "in.tiff"
subprocess.check_call(["convert", str(tmp_palette2_png), str(in_img)]) subprocess.check_call(
[
"convert",
str(tmp_palette2_png),
"-compress",
"Zip",
str(in_img)
]
)
identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"])) identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"]))
assert len(identify) == 1 assert len(identify) == 1
# somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was # somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was
@ -3125,7 +3259,15 @@ def tiff_palette2_img(tmp_path_factory, tmp_palette2_png):
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def tiff_palette4_img(tmp_path_factory, tmp_palette4_png): def tiff_palette4_img(tmp_path_factory, tmp_palette4_png):
in_img = tmp_path_factory.mktemp("tiff_palette4_img") / "in.tiff" in_img = tmp_path_factory.mktemp("tiff_palette4_img") / "in.tiff"
subprocess.check_call(["convert", str(tmp_palette4_png), str(in_img)]) subprocess.check_call(
[
"convert",
str(tmp_palette4_png),
"-compress",
"Zip",
str(in_img)
]
)
identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"])) identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"]))
assert len(identify) == 1 assert len(identify) == 1
# somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was # somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was
@ -3174,7 +3316,15 @@ def tiff_palette4_img(tmp_path_factory, tmp_palette4_png):
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def tiff_palette8_img(tmp_path_factory, tmp_palette8_png): def tiff_palette8_img(tmp_path_factory, tmp_palette8_png):
in_img = tmp_path_factory.mktemp("tiff_palette8_img") / "in.tiff" in_img = tmp_path_factory.mktemp("tiff_palette8_img") / "in.tiff"
subprocess.check_call(["convert", str(tmp_palette8_png), str(in_img)]) subprocess.check_call(
[
"convert",
str(tmp_palette8_png),
"-compress",
"Zip",
str(in_img)
]
)
identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"])) identify = json.loads(subprocess.check_output(["convert", str(in_img), "json:"]))
assert len(identify) == 1 assert len(identify) == 1
# somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was # somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was
@ -3234,6 +3384,8 @@ def tiff_ccitt_lsb_m2l_white_img(tmp_path_factory, tmp_gray1_png):
"tiff:fill-order=msb", "tiff:fill-order=msb",
"-define", "-define",
"quantum:polarity=min-is-white", "quantum:polarity=min-is-white",
"-compress",
"Group4",
str(in_img), str(in_img),
] ]
) )
@ -3313,6 +3465,8 @@ def tiff_ccitt_msb_m2l_white_img(tmp_path_factory, tmp_gray1_png):
"tiff:fill-order=msb", "tiff:fill-order=msb",
"-define", "-define",
"quantum:polarity=min-is-white", "quantum:polarity=min-is-white",
"-compress",
"Group4",
str(in_img), str(in_img),
] ]
) )
@ -3393,6 +3547,8 @@ def tiff_ccitt_msb_l2m_white_img(tmp_path_factory, tmp_gray1_png):
"tiff:fill-order=lsb", "tiff:fill-order=lsb",
"-define", "-define",
"quantum:polarity=min-is-white", "quantum:polarity=min-is-white",
"-compress",
"Group4",
str(in_img), str(in_img),
] ]
) )
@ -3478,6 +3634,8 @@ def tiff_ccitt_lsb_m2l_black_img(tmp_path_factory, tmp_gray1_png):
"tiff:fill-order=msb", "tiff:fill-order=msb",
"-define", "-define",
"quantum:polarity=min-is-black", "quantum:polarity=min-is-black",
"-compress",
"Group4",
str(in_img), str(in_img),
] ]
) )
@ -3557,6 +3715,8 @@ def tiff_ccitt_nometa1_img(tmp_path_factory, tmp_gray1_png):
"tiff:fill-order=msb", "tiff:fill-order=msb",
"-define", "-define",
"quantum:polarity=min-is-white", "quantum:polarity=min-is-white",
"-compress",
"Group4",
str(in_img), str(in_img),
] ]
) )
@ -3645,6 +3805,8 @@ def tiff_ccitt_nometa2_img(tmp_path_factory, tmp_gray1_png):
"tiff:fill-order=msb", "tiff:fill-order=msb",
"-define", "-define",
"quantum:polarity=min-is-white", "quantum:polarity=min-is-white",
"-compress",
"Group4",
str(in_img), str(in_img),
] ]
) )
@ -5048,7 +5210,7 @@ def test_jpg_cmyk(tmp_path_factory, jpg_cmyk_img, jpg_cmyk_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
@pytest.mark.skipif( @pytest.mark.skipif(
@ -5063,7 +5225,7 @@ def test_jpg_2000(tmp_path_factory, jpg_2000_img, jpg_2000_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_png_rgb8(tmp_path_factory, png_rgb8_img, png_rgb8_pdf): def test_png_rgb8(tmp_path_factory, png_rgb8_img, png_rgb8_pdf):
@ -5075,7 +5237,7 @@ def test_png_rgb8(tmp_path_factory, png_rgb8_img, png_rgb8_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_png_rgb16(tmp_path_factory, png_rgb16_img, png_rgb16_pdf): def test_png_rgb16(tmp_path_factory, png_rgb16_img, png_rgb16_pdf):
@ -5087,7 +5249,7 @@ def test_png_rgb16(tmp_path_factory, png_rgb16_img, png_rgb16_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
@pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"]) @pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"])
@ -5110,7 +5272,7 @@ def test_png_rgba8(tmp_path_factory, png_rgba8_img, engine):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
@pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"]) @pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"])
@ -5133,7 +5295,7 @@ def test_png_rgba16(tmp_path_factory, png_rgba16_img, engine):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
@pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"]) @pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"])
@ -5156,7 +5318,7 @@ def test_png_gray8a(tmp_path_factory, png_gray8a_img, engine):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
@pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"]) @pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"])
@ -5179,7 +5341,7 @@ def test_png_gray16a(tmp_path_factory, png_gray16a_img, engine):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_png_interlaced(tmp_path_factory, png_interlaced_img, png_interlaced_pdf): def test_png_interlaced(tmp_path_factory, png_interlaced_img, png_interlaced_pdf):
@ -5191,7 +5353,7 @@ def test_png_interlaced(tmp_path_factory, png_interlaced_img, png_interlaced_pdf
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_png_gray1(tmp_path_factory, png_gray1_img, png_gray1_pdf): def test_png_gray1(tmp_path_factory, png_gray1_img, png_gray1_pdf):
@ -5203,7 +5365,7 @@ def test_png_gray1(tmp_path_factory, png_gray1_img, png_gray1_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_png_gray2(tmp_path_factory, png_gray2_img, png_gray2_pdf): def test_png_gray2(tmp_path_factory, png_gray2_img, png_gray2_pdf):
@ -5215,7 +5377,7 @@ def test_png_gray2(tmp_path_factory, png_gray2_img, png_gray2_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_png_gray4(tmp_path_factory, png_gray4_img, png_gray4_pdf): def test_png_gray4(tmp_path_factory, png_gray4_img, png_gray4_pdf):
@ -5227,7 +5389,7 @@ def test_png_gray4(tmp_path_factory, png_gray4_img, png_gray4_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_png_gray8(tmp_path_factory, png_gray8_img, png_gray8_pdf): def test_png_gray8(tmp_path_factory, png_gray8_img, png_gray8_pdf):
@ -5239,7 +5401,7 @@ def test_png_gray8(tmp_path_factory, png_gray8_img, png_gray8_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_png_gray16(tmp_path_factory, png_gray16_img, png_gray16_pdf): def test_png_gray16(tmp_path_factory, png_gray16_img, png_gray16_pdf):
@ -5255,7 +5417,7 @@ def test_png_gray16(tmp_path_factory, png_gray16_img, png_gray16_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_png_palette1(tmp_path_factory, png_palette1_img, png_palette1_pdf): def test_png_palette1(tmp_path_factory, png_palette1_img, png_palette1_pdf):
@ -5267,7 +5429,7 @@ def test_png_palette1(tmp_path_factory, png_palette1_img, png_palette1_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_png_palette2(tmp_path_factory, png_palette2_img, png_palette2_pdf): def test_png_palette2(tmp_path_factory, png_palette2_img, png_palette2_pdf):
@ -5279,7 +5441,7 @@ def test_png_palette2(tmp_path_factory, png_palette2_img, png_palette2_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_png_palette4(tmp_path_factory, png_palette4_img, png_palette4_pdf): def test_png_palette4(tmp_path_factory, png_palette4_img, png_palette4_pdf):
@ -5291,7 +5453,7 @@ def test_png_palette4(tmp_path_factory, png_palette4_img, png_palette4_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_png_palette8(tmp_path_factory, png_palette8_img, png_palette8_pdf): def test_png_palette8(tmp_path_factory, png_palette8_img, png_palette8_pdf):
@ -5315,7 +5477,7 @@ def test_png_icc(tmp_path_factory, png_icc_img, png_icc_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
@pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"]) @pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"])
@ -5338,7 +5500,7 @@ def test_gif_transparent(tmp_path_factory, gif_transparent_img, engine):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_gif_palette1(tmp_path_factory, gif_palette1_img, gif_palette1_pdf): def test_gif_palette1(tmp_path_factory, gif_palette1_img, gif_palette1_pdf):
@ -5350,7 +5512,7 @@ def test_gif_palette1(tmp_path_factory, gif_palette1_img, gif_palette1_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_gif_palette2(tmp_path_factory, gif_palette2_img, gif_palette2_pdf): def test_gif_palette2(tmp_path_factory, gif_palette2_img, gif_palette2_pdf):
@ -5362,7 +5524,7 @@ def test_gif_palette2(tmp_path_factory, gif_palette2_img, gif_palette2_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_gif_palette4(tmp_path_factory, gif_palette4_img, gif_palette4_pdf): def test_gif_palette4(tmp_path_factory, gif_palette4_img, gif_palette4_pdf):
@ -5374,7 +5536,7 @@ def test_gif_palette4(tmp_path_factory, gif_palette4_img, gif_palette4_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_gif_palette8(tmp_path_factory, gif_palette8_img, gif_palette8_pdf): def test_gif_palette8(tmp_path_factory, gif_palette8_img, gif_palette8_pdf):
@ -5386,7 +5548,7 @@ def test_gif_palette8(tmp_path_factory, gif_palette8_img, gif_palette8_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_gif_animation(tmp_path_factory, gif_animation_img, gif_animation_pdf): def test_gif_animation(tmp_path_factory, gif_animation_img, gif_animation_pdf):
@ -5433,7 +5595,7 @@ def test_tiff_float(tmp_path_factory, tiff_float_img, engine):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_tiff_cmyk8(tmp_path_factory, tiff_cmyk8_img, tiff_cmyk8_pdf): def test_tiff_cmyk8(tmp_path_factory, tiff_cmyk8_img, tiff_cmyk8_pdf):
@ -5447,7 +5609,7 @@ def test_tiff_cmyk8(tmp_path_factory, tiff_cmyk8_img, tiff_cmyk8_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
@pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"]) @pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"])
@ -5471,7 +5633,7 @@ def test_tiff_cmyk16(tmp_path_factory, tiff_cmyk16_img, engine):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_tiff_rgb8(tmp_path_factory, tiff_rgb8_img, tiff_rgb8_pdf): def test_tiff_rgb8(tmp_path_factory, tiff_rgb8_img, tiff_rgb8_pdf):
@ -5483,7 +5645,7 @@ def test_tiff_rgb8(tmp_path_factory, tiff_rgb8_img, tiff_rgb8_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
@pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"]) @pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"])
@ -5507,7 +5669,7 @@ def test_tiff_rgb12(tmp_path_factory, tiff_rgb12_img, engine):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
@pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"]) @pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"])
@ -5531,7 +5693,7 @@ def test_tiff_rgb14(tmp_path_factory, tiff_rgb14_img, engine):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
@pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"]) @pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"])
@ -5555,7 +5717,7 @@ def test_tiff_rgb16(tmp_path_factory, tiff_rgb16_img, engine):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
@pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"]) @pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"])
@ -5578,7 +5740,7 @@ def test_tiff_rgba8(tmp_path_factory, tiff_rgba8_img, engine):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
@pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"]) @pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"])
@ -5601,7 +5763,7 @@ def test_tiff_rgba16(tmp_path_factory, tiff_rgba16_img, engine):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_tiff_gray1(tmp_path_factory, tiff_gray1_img, tiff_gray1_pdf): def test_tiff_gray1(tmp_path_factory, tiff_gray1_img, tiff_gray1_pdf):
@ -5613,7 +5775,7 @@ def test_tiff_gray1(tmp_path_factory, tiff_gray1_img, tiff_gray1_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_tiff_gray2(tmp_path_factory, tiff_gray2_img, tiff_gray2_pdf): def test_tiff_gray2(tmp_path_factory, tiff_gray2_img, tiff_gray2_pdf):
@ -5625,7 +5787,7 @@ def test_tiff_gray2(tmp_path_factory, tiff_gray2_img, tiff_gray2_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_tiff_gray4(tmp_path_factory, tiff_gray4_img, tiff_gray4_pdf): def test_tiff_gray4(tmp_path_factory, tiff_gray4_img, tiff_gray4_pdf):
@ -5637,7 +5799,7 @@ def test_tiff_gray4(tmp_path_factory, tiff_gray4_img, tiff_gray4_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_tiff_gray8(tmp_path_factory, tiff_gray8_img, tiff_gray8_pdf): def test_tiff_gray8(tmp_path_factory, tiff_gray8_img, tiff_gray8_pdf):
@ -5649,7 +5811,7 @@ def test_tiff_gray8(tmp_path_factory, tiff_gray8_img, tiff_gray8_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
@pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"]) @pytest.mark.parametrize("engine", ["internal", "pikepdf", "pdfrw"])
@ -5672,7 +5834,7 @@ def test_tiff_gray16(tmp_path_factory, tiff_gray16_img, engine):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_tiff_multipage(tmp_path_factory, tiff_multipage_img, tiff_multipage_pdf): def test_tiff_multipage(tmp_path_factory, tiff_multipage_img, tiff_multipage_pdf):
@ -5702,7 +5864,7 @@ def test_tiff_multipage(tmp_path_factory, tiff_multipage_img, tiff_multipage_pdf
reason="requires imagemagick with support for keeping the palette depth", reason="requires imagemagick with support for keeping the palette depth",
) )
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_tiff_palette1(tmp_path_factory, tiff_palette1_img, tiff_palette1_pdf): def test_tiff_palette1(tmp_path_factory, tiff_palette1_img, tiff_palette1_pdf):
@ -5718,7 +5880,7 @@ def test_tiff_palette1(tmp_path_factory, tiff_palette1_img, tiff_palette1_pdf):
reason="requires imagemagick with support for keeping the palette depth", reason="requires imagemagick with support for keeping the palette depth",
) )
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_tiff_palette2(tmp_path_factory, tiff_palette2_img, tiff_palette2_pdf): def test_tiff_palette2(tmp_path_factory, tiff_palette2_img, tiff_palette2_pdf):
@ -5734,7 +5896,7 @@ def test_tiff_palette2(tmp_path_factory, tiff_palette2_img, tiff_palette2_pdf):
reason="requires imagemagick with support for keeping the palette depth", reason="requires imagemagick with support for keeping the palette depth",
) )
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_tiff_palette4(tmp_path_factory, tiff_palette4_img, tiff_palette4_pdf): def test_tiff_palette4(tmp_path_factory, tiff_palette4_img, tiff_palette4_pdf):
@ -5746,7 +5908,7 @@ def test_tiff_palette4(tmp_path_factory, tiff_palette4_img, tiff_palette4_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_tiff_palette8(tmp_path_factory, tiff_palette8_img, tiff_palette8_pdf): def test_tiff_palette8(tmp_path_factory, tiff_palette8_img, tiff_palette8_pdf):
@ -5758,7 +5920,7 @@ def test_tiff_palette8(tmp_path_factory, tiff_palette8_img, tiff_palette8_pdf):
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_tiff_ccitt_lsb_m2l_white( def test_tiff_ccitt_lsb_m2l_white(
@ -5779,7 +5941,7 @@ def test_tiff_ccitt_lsb_m2l_white(
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_tiff_ccitt_msb_m2l_white( def test_tiff_ccitt_msb_m2l_white(
@ -5800,7 +5962,7 @@ def test_tiff_ccitt_msb_m2l_white(
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_tiff_ccitt_msb_l2m_white( def test_tiff_ccitt_msb_l2m_white(
@ -5825,7 +5987,7 @@ def test_tiff_ccitt_msb_l2m_white(
reason="requires imagemagick with support for min-is-black", reason="requires imagemagick with support for min-is-black",
) )
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_tiff_ccitt_lsb_m2l_black( def test_tiff_ccitt_lsb_m2l_black(
@ -5846,7 +6008,7 @@ def test_tiff_ccitt_lsb_m2l_black(
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_tiff_ccitt_nometa1( def test_tiff_ccitt_nometa1(
@ -5862,7 +6024,7 @@ def test_tiff_ccitt_nometa1(
@pytest.mark.skipif( @pytest.mark.skipif(
sys.platform in ["darwin", "win32"], sys.platform in ["win32"],
reason="test utilities not available on Windows and MacOS", reason="test utilities not available on Windows and MacOS",
) )
def test_tiff_ccitt_nometa2( def test_tiff_ccitt_nometa2(