Compare commits

...

3 commits

2 changed files with 29 additions and 258 deletions

View file

@ -1322,6 +1322,10 @@ def get_imgmetadata(
if depth > 8: if depth > 8:
logger.warning("Image with transparency and a bit depth of %d." % depth) logger.warning("Image with transparency and a bit depth of %d." % depth)
logger.warning("This is unsupported due to PIL limitations.") logger.warning("This is unsupported due to PIL limitations.")
logger.warning(
"If you accept a lossy conversion, you can manually convert "
"your images to 8 bit using `convert -depth 8` from imagemagick"
)
raise AlphaChannelError( raise AlphaChannelError(
"Refusing to work with multiple >8bit channels." "Refusing to work with multiple >8bit channels."
) )
@ -1432,11 +1436,22 @@ def get_imgmetadata(
iccp = None iccp = None
if "icc_profile" in imgdata.info: if "icc_profile" in imgdata.info:
iccp = imgdata.info.get("icc_profile") iccp = imgdata.info.get("icc_profile")
# GIMP saves bilevel tiff images with an RGB ICC profile which is useless # GIMP saves bilevel TIFF images and palette PNG images with only black and
# white in the palette with an RGB ICC profile which is useless
# https://gitlab.gnome.org/GNOME/gimp/-/issues/3438
# and produces an error in Adobe Acrobat, so we ignore it with a warning. # and produces an error in Adobe Acrobat, so we ignore it with a warning.
# imagemagick also used to (wrongly) include an RGB ICC profile for bilevel # imagemagick also used to (wrongly) include an RGB ICC profile for bilevel
# images: https://github.com/ImageMagick/ImageMagick/issues/2070 # images: https://github.com/ImageMagick/ImageMagick/issues/2070
if iccp is not None and color == Colorspace["1"] and imgformat == ImageFormat.TIFF: if iccp is not None and (
(color == Colorspace["1"] and imgformat == ImageFormat.TIFF)
or (
imgformat == ImageFormat.PNG
and color == Colorspace.P
and rawdata is not None
and parse_png(rawdata)[1]
in [b"\x00\x00\x00\xff\xff\xff", b"\xff\xff\xff\x00\x00\x00"]
)
):
with io.BytesIO(iccp) as f: with io.BytesIO(iccp) as f:
prf = ImageCms.ImageCmsProfile(f) prf = ImageCms.ImageCmsProfile(f)
if ( if (
@ -1444,7 +1459,14 @@ def get_imgmetadata(
and prf.profile.manufacturer == "GIMP" and prf.profile.manufacturer == "GIMP"
and prf.profile.profile_description == "GIMP built-in sRGB" and prf.profile.profile_description == "GIMP built-in sRGB"
): ):
logger.warning("Ignoring RGB ICC profile in bilevel TIFF produced by GIMP.") if imgformat == ImageFormat.TIFF:
logger.warning(
"Ignoring RGB ICC profile in bilevel TIFF produced by GIMP."
)
elif imgformat == ImageFormat.PNG:
logger.warning(
"Ignoring RGB ICC profile in 2-color palette PNG produced by GIMP."
)
logger.warning("https://gitlab.gnome.org/GNOME/gimp/-/issues/3438") logger.warning("https://gitlab.gnome.org/GNOME/gimp/-/issues/3438")
iccp = None iccp = None

View file

@ -24,8 +24,6 @@ import xml.etree.ElementTree as ET
img2pdfprog = os.getenv("img2pdfprog", default="src/img2pdf.py") img2pdfprog = os.getenv("img2pdfprog", default="src/img2pdf.py")
BYTEORDER = "LSB" if sys.byteorder == "little" else "MSB"
ICC_PROFILE = None ICC_PROFILE = None
ICC_PROFILE_PATHS = ( ICC_PROFILE_PATHS = (
# Debian # Debian
@ -2361,13 +2359,6 @@ def tiff_float_img(tmp_path_factory, tmp_normal_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColor", str(identify) assert identify[0]["image"].get("type") == "TrueColor", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
assert identify[0]["image"].get("baseDepth") == 32, str(identify) assert identify[0]["image"].get("baseDepth") == 32, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
@ -2383,10 +2374,6 @@ def tiff_float_img(tmp_path_factory, tmp_normal_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") == "RGB" identify[0]["image"].get("properties", {}).get("tiff:photometric") == "RGB"
), str(identify) ), str(identify)
@ -2426,13 +2413,6 @@ def tiff_cmyk8_img(tmp_path_factory, tmp_normal_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "CMYK", str(identify) assert identify[0]["image"].get("colorspace") == "CMYK", str(identify)
assert identify[0]["image"].get("type") == "ColorSeparation", str(identify) assert identify[0]["image"].get("type") == "ColorSeparation", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -2443,10 +2423,6 @@ def tiff_cmyk8_img(tmp_path_factory, tmp_normal_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") identify[0]["image"].get("properties", {}).get("tiff:photometric")
== "separated" == "separated"
@ -2489,13 +2465,6 @@ def tiff_cmyk16_img(tmp_path_factory, tmp_normal_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "CMYK", str(identify) assert identify[0]["image"].get("colorspace") == "CMYK", str(identify)
assert identify[0]["image"].get("type") == "ColorSeparation", str(identify) assert identify[0]["image"].get("type") == "ColorSeparation", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 16, str(identify) assert identify[0]["image"].get("depth") == 16, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -2506,10 +2475,6 @@ def tiff_cmyk16_img(tmp_path_factory, tmp_normal_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") identify[0]["image"].get("properties", {}).get("tiff:photometric")
== "separated" == "separated"
@ -2542,13 +2507,6 @@ def tiff_rgb8_img(tmp_path_factory, tmp_normal_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColor", str(identify) assert identify[0]["image"].get("type") == "TrueColor", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -2559,10 +2517,6 @@ def tiff_rgb8_img(tmp_path_factory, tmp_normal_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") == "RGB" identify[0]["image"].get("properties", {}).get("tiff:photometric") == "RGB"
), str(identify) ), str(identify)
@ -2602,13 +2556,6 @@ def tiff_rgb12_img(tmp_path_factory, tmp_normal16_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColor", str(identify) assert identify[0]["image"].get("type") == "TrueColor", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("baseDepth") == 12, str(identify) assert identify[0]["image"].get("baseDepth") == 12, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -2619,10 +2566,6 @@ def tiff_rgb12_img(tmp_path_factory, tmp_normal16_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") == "RGB" identify[0]["image"].get("properties", {}).get("tiff:photometric") == "RGB"
), str(identify) ), str(identify)
@ -2662,13 +2605,6 @@ def tiff_rgb14_img(tmp_path_factory, tmp_normal16_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColor", str(identify) assert identify[0]["image"].get("type") == "TrueColor", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("baseDepth") == 14, str(identify) assert identify[0]["image"].get("baseDepth") == 14, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -2679,10 +2615,6 @@ def tiff_rgb14_img(tmp_path_factory, tmp_normal16_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") == "RGB" identify[0]["image"].get("properties", {}).get("tiff:photometric") == "RGB"
), str(identify) ), str(identify)
@ -2722,13 +2654,6 @@ def tiff_rgb16_img(tmp_path_factory, tmp_normal16_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColor", str(identify) assert identify[0]["image"].get("type") == "TrueColor", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 16, str(identify) assert identify[0]["image"].get("depth") == 16, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -2739,10 +2664,6 @@ def tiff_rgb16_img(tmp_path_factory, tmp_normal16_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") == "RGB" identify[0]["image"].get("properties", {}).get("tiff:photometric") == "RGB"
), str(identify) ), str(identify)
@ -2783,13 +2704,6 @@ def tiff_rgba8_img(tmp_path_factory, tmp_alpha_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColorAlpha", str(identify) assert identify[0]["image"].get("type") == "TrueColorAlpha", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -2800,10 +2714,6 @@ def tiff_rgba8_img(tmp_path_factory, tmp_alpha_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unassociated" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unassociated"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") == "RGB" identify[0]["image"].get("properties", {}).get("tiff:photometric") == "RGB"
), str(identify) ), str(identify)
@ -2844,13 +2754,6 @@ def tiff_rgba16_img(tmp_path_factory, tmp_alpha_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColorAlpha", str(identify) assert identify[0]["image"].get("type") == "TrueColorAlpha", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 16, str(identify) assert identify[0]["image"].get("depth") == 16, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -2861,10 +2764,6 @@ def tiff_rgba16_img(tmp_path_factory, tmp_alpha_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unassociated" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unassociated"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") == "RGB" identify[0]["image"].get("properties", {}).get("tiff:photometric") == "RGB"
), str(identify) ), str(identify)
@ -2904,13 +2803,6 @@ def tiff_gray1_img(tmp_path_factory, tmp_gray1_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "Gray", str(identify) assert identify[0]["image"].get("colorspace") == "Gray", str(identify)
assert identify[0]["image"].get("type") == "Bilevel", str(identify) assert identify[0]["image"].get("type") == "Bilevel", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 1, str(identify) assert identify[0]["image"].get("depth") == 1, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -2921,10 +2813,6 @@ def tiff_gray1_img(tmp_path_factory, tmp_gray1_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") identify[0]["image"].get("properties", {}).get("tiff:photometric")
== "min-is-black" == "min-is-black"
@ -2965,13 +2853,6 @@ def tiff_gray2_img(tmp_path_factory, tmp_gray2_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "Gray", str(identify) assert identify[0]["image"].get("colorspace") == "Gray", str(identify)
assert identify[0]["image"].get("type") == "Grayscale", str(identify) assert identify[0]["image"].get("type") == "Grayscale", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 2, str(identify) assert identify[0]["image"].get("depth") == 2, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -2982,10 +2863,6 @@ def tiff_gray2_img(tmp_path_factory, tmp_gray2_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") identify[0]["image"].get("properties", {}).get("tiff:photometric")
== "min-is-black" == "min-is-black"
@ -3026,13 +2903,6 @@ def tiff_gray4_img(tmp_path_factory, tmp_gray4_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "Gray", str(identify) assert identify[0]["image"].get("colorspace") == "Gray", str(identify)
assert identify[0]["image"].get("type") == "Grayscale", str(identify) assert identify[0]["image"].get("type") == "Grayscale", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 4, str(identify) assert identify[0]["image"].get("depth") == 4, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -3043,10 +2913,6 @@ def tiff_gray4_img(tmp_path_factory, tmp_gray4_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") identify[0]["image"].get("properties", {}).get("tiff:photometric")
== "min-is-black" == "min-is-black"
@ -3087,13 +2953,6 @@ def tiff_gray8_img(tmp_path_factory, tmp_gray8_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "Gray", str(identify) assert identify[0]["image"].get("colorspace") == "Gray", str(identify)
assert identify[0]["image"].get("type") == "Grayscale", str(identify) assert identify[0]["image"].get("type") == "Grayscale", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -3104,10 +2963,6 @@ def tiff_gray8_img(tmp_path_factory, tmp_gray8_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") identify[0]["image"].get("properties", {}).get("tiff:photometric")
== "min-is-black" == "min-is-black"
@ -3148,13 +3003,6 @@ def tiff_gray16_img(tmp_path_factory, tmp_gray16_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "Gray", str(identify) assert identify[0]["image"].get("colorspace") == "Gray", str(identify)
assert identify[0]["image"].get("type") == "Grayscale", str(identify) assert identify[0]["image"].get("type") == "Grayscale", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 16, str(identify) assert identify[0]["image"].get("depth") == 16, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -3165,10 +3013,6 @@ def tiff_gray16_img(tmp_path_factory, tmp_gray16_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") identify[0]["image"].get("properties", {}).get("tiff:photometric")
== "min-is-black" == "min-is-black"
@ -3211,13 +3055,6 @@ def tiff_multipage_img(tmp_path_factory, tmp_normal_png, tmp_inverse_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColor", str(identify) assert identify[0]["image"].get("type") == "TrueColor", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -3228,10 +3065,6 @@ def tiff_multipage_img(tmp_path_factory, tmp_normal_png, tmp_inverse_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") == "RGB" identify[0]["image"].get("properties", {}).get("tiff:photometric") == "RGB"
), str(identify) ), str(identify)
@ -3255,13 +3088,6 @@ def tiff_multipage_img(tmp_path_factory, tmp_normal_png, tmp_inverse_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColor", str(identify) assert identify[0]["image"].get("type") == "TrueColor", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -3272,10 +3098,6 @@ def tiff_multipage_img(tmp_path_factory, tmp_normal_png, tmp_inverse_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") == "RGB" identify[0]["image"].get("properties", {}).get("tiff:photometric") == "RGB"
), str(identify) ), str(identify)
@ -3308,13 +3130,6 @@ def tiff_palette1_img(tmp_path_factory, tmp_palette1_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "Palette", str(identify) assert identify[0]["image"].get("type") == "Palette", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
assert identify[0]["image"].get("baseDepth") == 1, str(identify) assert identify[0]["image"].get("baseDepth") == 1, str(identify)
assert identify[0]["image"].get("colormapEntries") == 2, str(identify) assert identify[0]["image"].get("colormapEntries") == 2, str(identify)
@ -3327,10 +3142,6 @@ def tiff_palette1_img(tmp_path_factory, tmp_palette1_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") == "palette" identify[0]["image"].get("properties", {}).get("tiff:photometric") == "palette"
), str(identify) ), str(identify)
@ -3362,13 +3173,6 @@ def tiff_palette2_img(tmp_path_factory, tmp_palette2_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "Palette", str(identify) assert identify[0]["image"].get("type") == "Palette", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
assert identify[0]["image"].get("baseDepth") == 2, str(identify) assert identify[0]["image"].get("baseDepth") == 2, str(identify)
assert identify[0]["image"].get("colormapEntries") == 4, str(identify) assert identify[0]["image"].get("colormapEntries") == 4, str(identify)
@ -3381,10 +3185,6 @@ def tiff_palette2_img(tmp_path_factory, tmp_palette2_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") == "palette" identify[0]["image"].get("properties", {}).get("tiff:photometric") == "palette"
), str(identify) ), str(identify)
@ -3416,13 +3216,6 @@ def tiff_palette4_img(tmp_path_factory, tmp_palette4_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "Palette", str(identify) assert identify[0]["image"].get("type") == "Palette", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
assert identify[0]["image"].get("baseDepth") == 4, str(identify) assert identify[0]["image"].get("baseDepth") == 4, str(identify)
assert identify[0]["image"].get("colormapEntries") == 16, str(identify) assert identify[0]["image"].get("colormapEntries") == 16, str(identify)
@ -3435,10 +3228,6 @@ def tiff_palette4_img(tmp_path_factory, tmp_palette4_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") == "palette" identify[0]["image"].get("properties", {}).get("tiff:photometric") == "palette"
), str(identify) ), str(identify)
@ -3470,13 +3259,6 @@ def tiff_palette8_img(tmp_path_factory, tmp_palette8_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "Palette", str(identify) assert identify[0]["image"].get("type") == "Palette", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
assert identify[0]["image"].get("colormapEntries") == 256, str(identify) assert identify[0]["image"].get("colormapEntries") == 256, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
@ -3488,10 +3270,6 @@ def tiff_palette8_img(tmp_path_factory, tmp_palette8_png):
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified" identify[0]["image"].get("properties", {}).get("tiff:alpha") == "unspecified"
), str(identify) ), str(identify)
assert (
identify[0]["image"].get("properties", {}).get("tiff:endian")
== BYTEORDER.lower()
), str(identify)
assert ( assert (
identify[0]["image"].get("properties", {}).get("tiff:photometric") == "palette" identify[0]["image"].get("properties", {}).get("tiff:photometric") == "palette"
), str(identify) ), str(identify)
@ -3541,9 +3319,7 @@ def tiff_ccitt_lsb_m2l_white_img(tmp_path_factory, tmp_gray1_png):
assert identify[0]["image"].get(endian) in [ assert identify[0]["image"].get(endian) in [
"Undefined", "Undefined",
"LSB", "LSB",
], str( ], str(identify)
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 1, str(identify) assert identify[0]["image"].get("depth") == 1, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -3794,9 +3570,7 @@ def tiff_ccitt_lsb_m2l_black_img(tmp_path_factory, tmp_gray1_png):
assert identify[0]["image"].get(endian) in [ assert identify[0]["image"].get(endian) in [
"Undefined", "Undefined",
"LSB", "LSB",
], str( ], str(identify)
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 1, str(identify) assert identify[0]["image"].get("depth") == 1, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -3887,9 +3661,7 @@ def tiff_ccitt_nometa1_img(tmp_path_factory, tmp_gray1_png):
assert identify[0]["image"].get(endian) in [ assert identify[0]["image"].get(endian) in [
"Undefined", "Undefined",
"LSB", "LSB",
], str( ], str(identify)
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 1, str(identify) assert identify[0]["image"].get("depth") == 1, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -3974,9 +3746,7 @@ def tiff_ccitt_nometa2_img(tmp_path_factory, tmp_gray1_png):
assert identify[0]["image"].get(endian) in [ assert identify[0]["image"].get(endian) in [
"Undefined", "Undefined",
"LSB", "LSB",
], str( ], str(identify)
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("colorspace") == "Gray", str(identify) assert identify[0]["image"].get("colorspace") == "Gray", str(identify)
assert identify[0]["image"].get("depth") == 1, str(identify) assert identify[0]["image"].get("depth") == 1, str(identify)
assert identify[0]["image"].get("compression") == "Group4", str(identify) assert identify[0]["image"].get("compression") == "Group4", str(identify)
@ -4042,13 +3812,6 @@ def miff_cmyk8_img(tmp_path_factory, tmp_normal_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "CMYK", str(identify) assert identify[0]["image"].get("colorspace") == "CMYK", str(identify)
assert identify[0]["image"].get("type") == "ColorSeparation", str(identify) assert identify[0]["image"].get("type") == "ColorSeparation", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,
@ -4093,13 +3856,6 @@ def miff_cmyk16_img(tmp_path_factory, tmp_normal_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "CMYK", str(identify) assert identify[0]["image"].get("colorspace") == "CMYK", str(identify)
assert identify[0]["image"].get("type") == "ColorSeparation", str(identify) assert identify[0]["image"].get("type") == "ColorSeparation", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 16, str(identify) assert identify[0]["image"].get("depth") == 16, str(identify)
assert identify[0]["image"].get("baseDepth") == 16, str(identify) assert identify[0]["image"].get("baseDepth") == 16, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
@ -4135,13 +3891,6 @@ def miff_rgb8_img(tmp_path_factory, tmp_normal_png):
}, str(identify) }, str(identify)
assert identify[0]["image"].get("colorspace") == "sRGB", str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", str(identify)
assert identify[0]["image"].get("type") == "TrueColor", str(identify) assert identify[0]["image"].get("type") == "TrueColor", str(identify)
endian = "endianess" if identify[0].get("version", "0") < "1.0" else "endianness"
assert identify[0]["image"].get(endian) in [
"Undefined",
BYTEORDER,
], str(
identify
) # FIXME: should be LSB
assert identify[0]["image"].get("depth") == 8, str(identify) assert identify[0]["image"].get("depth") == 8, str(identify)
assert identify[0]["image"].get("pageGeometry") == { assert identify[0]["image"].get("pageGeometry") == {
"width": 60, "width": 60,