Compare commits
No commits in common. "635b08c321d83544af0d4266cd4ef2e4869beb3b" and "4c5b72dab02a7dc9590ab4e760acd3764094fea8" have entirely different histories.
635b08c321
...
4c5b72dab0
3 changed files with 50 additions and 23 deletions
|
@ -13,6 +13,7 @@ matrix:
|
|||
- netpbm
|
||||
- ghostscript
|
||||
- mupdf-tools
|
||||
- icc-profiles-free
|
||||
- name: "python 3.9 Windows"
|
||||
os: windows
|
||||
language: shell # 'language: python' is an error on Travis CI Windows
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[](https://app.travis-ci.com/josch/img2pdf)
|
||||
[](https://ci.appveyor.com/project/josch/img2pdf/branch/main)
|
||||
[](https://travis-ci.org/josch/img2pdf)
|
||||
[](https://ci.appveyor.com/project/josch/img2pdf/branch/master)
|
||||
|
||||
img2pdf
|
||||
=======
|
||||
|
|
|
@ -20,21 +20,6 @@ import warnings
|
|||
import json
|
||||
import pathlib
|
||||
|
||||
ICC_PROFILE = None
|
||||
ICC_PROFILE_PATHS = (
|
||||
# Debian
|
||||
"/usr/share/color/icc/ghostscript/srgb.icc",
|
||||
# Fedora
|
||||
"/usr/share/ghostscript/iccprofiles/srgb.icc",
|
||||
# Archlinux and Gentoo
|
||||
"/usr/share/ghostscript/*/iccprofiles/srgb.icc",
|
||||
)
|
||||
for glob in ICC_PROFILE_PATHS:
|
||||
for path in pathlib.Path("/").glob(glob.lstrip("/")):
|
||||
if path.is_file():
|
||||
ICC_PROFILE = path
|
||||
break
|
||||
|
||||
HAVE_MUTOOL = True
|
||||
try:
|
||||
ver = subprocess.check_output(["mutool", "-v"], stderr=subprocess.STDOUT)
|
||||
|
@ -319,9 +304,11 @@ def compare(im1, im2, exact, icc, cmyk):
|
|||
else:
|
||||
iccargs = []
|
||||
if icc:
|
||||
if ICC_PROFILE is None:
|
||||
pytest.skip("Could not locate an ICC profile")
|
||||
iccargs = ["-profile", ICC_PROFILE]
|
||||
profile = "/usr/share/color/icc/sRGB.icc"
|
||||
if not os.path.isfile(profile):
|
||||
warnings.warn(profile + " not present, skipping checks...")
|
||||
return
|
||||
iccargs = ["-profile", profile]
|
||||
psnr = subprocess.run(
|
||||
["compare"]
|
||||
+ iccargs
|
||||
|
@ -434,8 +421,10 @@ def compare_pdfimages_png(tmpdir, img, pdf, exact=True, icc=False):
|
|||
)
|
||||
else:
|
||||
if icc:
|
||||
if ICC_PROFILE is None:
|
||||
pytest.skip("Could not locate an ICC profile")
|
||||
profile = "/usr/share/color/icc/ghostscript/srgb.icc"
|
||||
if not os.path.isfile(profile):
|
||||
warnings.warn(profile + " not present, skipping checks...")
|
||||
return
|
||||
psnr = subprocess.run(
|
||||
[
|
||||
"compare",
|
||||
|
@ -443,7 +432,7 @@ def compare_pdfimages_png(tmpdir, img, pdf, exact=True, icc=False):
|
|||
"PSNR",
|
||||
"(",
|
||||
"-profile",
|
||||
ICC_PROFILE,
|
||||
profile,
|
||||
"-depth",
|
||||
"8",
|
||||
str(img),
|
||||
|
@ -1165,6 +1154,7 @@ def png_rgb8_img(tmp_normal_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("png:IHDR.bit-depth-orig") == "8"
|
||||
), str(identify)
|
||||
|
@ -1214,6 +1204,7 @@ def png_rgb16_img(tmp_normal16_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("png:IHDR.bit-depth-orig")
|
||||
== "16"
|
||||
|
@ -1267,6 +1258,7 @@ def png_rgba8_img(tmp_path_factory, tmp_alpha_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("png:IHDR.bit-depth-orig") == "8"
|
||||
), str(identify)
|
||||
|
@ -1317,6 +1309,7 @@ def png_rgba16_img(tmp_alpha_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("png:IHDR.bit-depth-orig")
|
||||
== "16"
|
||||
|
@ -1383,6 +1376,7 @@ def png_gray8a_img(tmp_path_factory, tmp_alpha_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("png:IHDR.bit-depth-orig") == "8"
|
||||
), str(identify)
|
||||
|
@ -1445,6 +1439,7 @@ def png_gray16a_img(tmp_path_factory, tmp_alpha_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("png:IHDR.bit-depth-orig")
|
||||
== "16"
|
||||
|
@ -1499,6 +1494,7 @@ def png_interlaced_img(tmp_path_factory, tmp_normal_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("png:IHDR.bit-depth-orig") == "8"
|
||||
), str(identify)
|
||||
|
@ -1550,6 +1546,7 @@ def png_gray1_img(tmp_path_factory, tmp_gray1_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("png:IHDR.bit-depth-orig") == "1"
|
||||
), str(identify)
|
||||
|
@ -1600,6 +1597,7 @@ def png_gray2_img(tmp_path_factory, tmp_gray2_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("png:IHDR.bit-depth-orig") == "2"
|
||||
), str(identify)
|
||||
|
@ -1650,6 +1648,7 @@ def png_gray4_img(tmp_path_factory, tmp_gray4_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("png:IHDR.bit-depth-orig") == "4"
|
||||
), str(identify)
|
||||
|
@ -1700,6 +1699,7 @@ def png_gray8_img(tmp_path_factory, tmp_gray8_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("png:IHDR.bit-depth-orig") == "8"
|
||||
), str(identify)
|
||||
|
@ -1750,6 +1750,7 @@ def png_gray16_img(tmp_path_factory, tmp_gray16_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("png:IHDR.bit-depth-orig")
|
||||
== "16"
|
||||
|
@ -1801,6 +1802,7 @@ def png_palette1_img(tmp_path_factory, tmp_palette1_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("png:IHDR.bit-depth-orig") == "1"
|
||||
), str(identify)
|
||||
|
@ -1851,6 +1853,7 @@ def png_palette2_img(tmp_path_factory, tmp_palette2_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("png:IHDR.bit-depth-orig") == "2"
|
||||
), str(identify)
|
||||
|
@ -1901,6 +1904,7 @@ def png_palette4_img(tmp_path_factory, tmp_palette4_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("png:IHDR.bit-depth-orig") == "4"
|
||||
), str(identify)
|
||||
|
@ -1951,6 +1955,7 @@ def png_palette8_img(tmp_path_factory, tmp_palette8_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("png:IHDR.bit-depth-orig") == "8"
|
||||
), str(identify)
|
||||
|
@ -2260,6 +2265,7 @@ def tiff_float_img(tmp_path_factory, tmp_normal_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("quantum:format")
|
||||
== "floating-point"
|
||||
|
@ -2312,6 +2318,7 @@ def tiff_cmyk8_img(tmp_path_factory, tmp_normal_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
|
||||
), str(identify)
|
||||
|
@ -2369,6 +2376,7 @@ def tiff_cmyk16_img(tmp_path_factory, tmp_normal_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
|
||||
), str(identify)
|
||||
|
@ -2416,6 +2424,7 @@ def tiff_rgb8_img(tmp_path_factory, tmp_normal_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
|
||||
), str(identify)
|
||||
|
@ -2468,6 +2477,7 @@ def tiff_rgb12_img(tmp_path_factory, tmp_normal16_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
|
||||
), str(identify)
|
||||
|
@ -2520,6 +2530,7 @@ def tiff_rgb14_img(tmp_path_factory, tmp_normal16_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
|
||||
), str(identify)
|
||||
|
@ -2568,6 +2579,7 @@ def tiff_rgb16_img(tmp_path_factory, tmp_normal16_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
|
||||
), str(identify)
|
||||
|
@ -2616,6 +2628,7 @@ def tiff_rgba8_img(tmp_path_factory, tmp_alpha_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unassociated"
|
||||
), str(identify)
|
||||
|
@ -2664,6 +2677,7 @@ def tiff_rgba16_img(tmp_path_factory, tmp_alpha_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unassociated"
|
||||
), str(identify)
|
||||
|
@ -2710,6 +2724,7 @@ def tiff_gray1_img(tmp_path_factory, tmp_gray1_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
|
||||
), str(identify)
|
||||
|
@ -2757,6 +2772,7 @@ def tiff_gray2_img(tmp_path_factory, tmp_gray2_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
|
||||
), str(identify)
|
||||
|
@ -2804,6 +2820,7 @@ def tiff_gray4_img(tmp_path_factory, tmp_gray4_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
|
||||
), str(identify)
|
||||
|
@ -2851,6 +2868,7 @@ def tiff_gray8_img(tmp_path_factory, tmp_gray8_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
|
||||
), str(identify)
|
||||
|
@ -2898,6 +2916,7 @@ def tiff_gray16_img(tmp_path_factory, tmp_gray16_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
|
||||
), str(identify)
|
||||
|
@ -2949,6 +2968,7 @@ def tiff_multipage_img(tmp_path_factory, tmp_normal_png, tmp_inverse_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
|
||||
), str(identify)
|
||||
|
@ -2989,6 +3009,7 @@ def tiff_multipage_img(tmp_path_factory, tmp_normal_png, tmp_inverse_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
|
||||
), str(identify)
|
||||
|
@ -3038,6 +3059,7 @@ def tiff_palette1_img(tmp_path_factory, tmp_palette1_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
|
||||
), str(identify)
|
||||
|
@ -3086,6 +3108,7 @@ def tiff_palette2_img(tmp_path_factory, tmp_palette2_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
|
||||
), str(identify)
|
||||
|
@ -3134,6 +3157,7 @@ def tiff_palette4_img(tmp_path_factory, tmp_palette4_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
|
||||
), str(identify)
|
||||
|
@ -3181,6 +3205,7 @@ def tiff_palette8_img(tmp_path_factory, tmp_palette8_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
|
||||
), str(identify)
|
||||
|
@ -3710,6 +3735,7 @@ def png_icc_img(tmp_icc_png):
|
|||
"x": 0,
|
||||
"y": 0,
|
||||
}, str(identify)
|
||||
assert identify[0]["image"].get("compression") == "Zip", str(identify)
|
||||
assert (
|
||||
identify[0]["image"].get("properties", {}).get("png:IHDR.bit-depth-orig") == "8"
|
||||
), str(identify)
|
||||
|
|
Loading…
Reference in a new issue