test_tiff_rgb12 and test_tiff_rgb14 fail with ImageMagick 6.9.10 #119

Closed
opened 2021-08-22 16:25:30 +00:00 by sbraz · 7 comments
Contributor

Hi,
I found out why some of the tests fail on Travis. When you check for the version, e.g. here, you enter a different branch of the if.

Ubuntu Focal's (ImageMagick 6.9.10-23) doesn't have that version attribute which was added in 6.9.11 (the version Bullseye has).

If you remove the if for both PNG TIFF tests, they should pass on both Ubuntu Focal and Debian Bullseye.

Hi, I found out why some of the tests fail on Travis. When you check for the version, e.g. [here](https://gitlab.mister-muffin.de/josch/img2pdf/src/branch/main/src/img2pdf_test.py#L2563), you enter a different branch of the if. Ubuntu Focal's (ImageMagick 6.9.10-23) doesn't have that version attribute which was added in 6.9.11 (the version Bullseye has). If you remove the if for both PNG TIFF tests, they should pass on both Ubuntu Focal and Debian Bullseye.
sbraz changed title from test_tiff_rgb12 and test_tiff_rgb14 fails with ImageMagick 6.9.10 to test_tiff_rgb12 and test_tiff_rgb14 fail with ImageMagick 6.9.10 2021-08-22 16:27:01 +00:00
Owner

Thanks for looking into this! But I don't think I follow. I can confirm that on Debian Bullseye, the else clause is the right one, the one which says:

assert identify[0]["image"].get("depth") == 16, str(identify)

But for for older imagemagick versions, meaning those less than 1.0 or those without the version information, the value 14 should be correct. That's why I use identify[0].get() and default to "0" in case the version attribute is missing.

Are you saying that Ubuntu Focal also needs the value 16? What value is needed for ImageMagick 7?

Thanks for looking into this! But I don't think I follow. I can confirm that on Debian Bullseye, the `else` clause is the right one, the one which says: assert identify[0]["image"].get("depth") == 16, str(identify) But for for older imagemagick versions, meaning those less than 1.0 or those without the `version` information, the value `14` should be correct. That's why I use `identify[0].get()` and default to `"0"` in case the version attribute is missing. Are you saying that Ubuntu Focal also needs the value `16`? What value is needed for ImageMagick 7?
Author
Contributor

Are you saying that Ubuntu Focal also needs the value 16? What value is needed for ImageMagick 7?

Yes, I think so. Throughout my tests, I saw that all versions (Gentoo or Arch with IM 7, Focal and Buster with IM 6, be it before or after the JSON version attribute appeared) seem to need 16. The Travis build shows what happens on Focal:
https://app.travis-ci.com/github/josch/img2pdf/jobs/533073335

_________________ ERROR at setup of test_tiff_rgb12[internal] __________________
[…]
if identify[0].get("version", "0") < "1.0":

>           assert identify[0]["image"].get("depth") == 12, str(identify)
E           AssertionError: […]
E           assert 16 == 12
E             +16
E             -12

I see that when that version 1.0 attribute was added, a typo was fixed in "endianness" but I didn't see any mention of bit depth in the changelog.

On a slightly different topic, I have also noticed that a lot of tests (not necessarily these two) dislike ImageMagick built with --with-quantum-depth=8 or 32 instead of 16, I stumbled on this today via https://bugs.gentoo.org/809593 (build log here).

> Are you saying that Ubuntu Focal also needs the value 16? What value is needed for ImageMagick 7? Yes, I think so. Throughout my tests, I saw that all versions (Gentoo or Arch with IM 7, Focal and Buster with IM 6, be it before or after the JSON version attribute appeared) seem to need `16`. The Travis build shows what happens on Focal: https://app.travis-ci.com/github/josch/img2pdf/jobs/533073335 ``` _________________ ERROR at setup of test_tiff_rgb12[internal] __________________ […] if identify[0].get("version", "0") < "1.0": > assert identify[0]["image"].get("depth") == 12, str(identify) E AssertionError: […] E assert 16 == 12 E +16 E -12 ``` I see that when that version 1.0 attribute was added, a typo was fixed in "endianness" but I didn't see any mention of bit depth in [the changelog](https://github.com/ImageMagick/ImageMagick6/blob/main/ChangeLog). On a slightly different topic, I have also noticed that a lot of tests (not necessarily these two) dislike ImageMagick built with `--with-quantum-depth=8` or 32 instead of 16, I stumbled on this today via https://bugs.gentoo.org/809593 (build log [here](https://809593.bugs.gentoo.org/attachment.cgi?id=735071)).
Owner

Are you saying that Ubuntu Focal also needs the value 16? What value is needed for ImageMagick 7?

Yes, I think so. Throughout my tests, I saw that all versions (Gentoo or Arch with IM 7, Focal and Buster with IM 6, be it before or after the JSON version attribute appeared) seem to need 16. The Travis build shows what happens on Focal:
https://app.travis-ci.com/github/josch/img2pdf/jobs/533073335

_________________ ERROR at setup of test_tiff_rgb12[internal] __________________
[…]
if identify[0].get("version", "0") < "1.0":

>           assert identify[0]["image"].get("depth") == 12, str(identify)
E           AssertionError: […]
E           assert 16 == 12
E             +16
E             -12

I see that when that version 1.0 attribute was added, a typo was fixed in "endianness" but I didn't see any mention of bit depth in the changelog.

Alright, if you open a merge request, I'll make the change accordingly and drop the if.

On a slightly different topic, I have also noticed that a lot of tests (not necessarily these two) dislike ImageMagick built with --with-quantum-depth=8 or 32 instead of 16, I stumbled on this today via https://bugs.gentoo.org/809593 (build log here).

From reading the log, could it be that the depth attribute actually reflects the quantum-depth? I don't see this explained in the imagemagick docs, but if so, then we should never check the depth attribute anyways but only look at baseDepth.

It's great that you are testing img2pdf on gentoo. The disadvantage of binary distributions like Debian and Ubuntu is, that my code is never run with its dependencies built with different configure settings.

> > Are you saying that Ubuntu Focal also needs the value 16? What value is needed for ImageMagick 7? > > Yes, I think so. Throughout my tests, I saw that all versions (Gentoo or Arch with IM 7, Focal and Buster with IM 6, be it before or after the JSON version attribute appeared) seem to need `16`. The Travis build shows what happens on Focal: > https://app.travis-ci.com/github/josch/img2pdf/jobs/533073335 > > ``` > _________________ ERROR at setup of test_tiff_rgb12[internal] __________________ > […] > if identify[0].get("version", "0") < "1.0": > > > assert identify[0]["image"].get("depth") == 12, str(identify) > E AssertionError: […] > E assert 16 == 12 > E +16 > E -12 > ``` > > I see that when that version 1.0 attribute was added, a typo was fixed in "endianness" but I didn't see any mention of bit depth in [the changelog](https://github.com/ImageMagick/ImageMagick6/blob/main/ChangeLog). Alright, if you open a merge request, I'll make the change accordingly and drop the if. > On a slightly different topic, I have also noticed that a lot of tests (not necessarily these two) dislike ImageMagick built with `--with-quantum-depth=8` or 32 instead of 16, I stumbled on this today via https://bugs.gentoo.org/809593 (build log [here](https://809593.bugs.gentoo.org/attachment.cgi?id=735071)). From reading the log, could it be that the `depth` attribute actually reflects the quantum-depth? I don't see this explained in the imagemagick docs, but if so, then we should never check the `depth` attribute anyways but only look at `baseDepth`. It's great that you are testing img2pdf on gentoo. The disadvantage of binary distributions like Debian and Ubuntu is, that my code is never run with its dependencies built with different configure settings.

We disabled these two tests when we started running the test suite for img2pdf in 2022/01.

============================= test session starts ==============================
platform linux -- Python 3.10.6, pytest-7.1.2, pluggy-1.0.0
rootdir: /build/img2pdf-0.4.4
collected 301 items                                                            

src/img2pdf_test.py ......ss................................ss.......... [ 17%]
..........EEEE.......................................................... [ 41%]
........................................................................ [ 65%]
........................................................................ [ 89%]
.................................                                        [100%]

==================================== ERRORS ====================================
_________________ ERROR at setup of test_tiff_rgb12[internal] __________________

tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7ffff6a50850>, _basetemp=PosixPath('/build/pytest-of-nixbld/pytest-0'))
tmp_normal16_png = PosixPath('/build/pytest-of-nixbld/pytest-0/normal16_png0/normal16.png')

    @pytest.fixture(scope="session")
    def tiff_rgb12_img(tmp_path_factory, tmp_normal16_png):
        in_img = tmp_path_factory.mktemp("tiff_rgb8") / "in.tiff"
        subprocess.check_call(
            CONVERT
            + [
                str(tmp_normal16_png),
                "-depth",
                "12",
                "-compress",
                "Zip",
                str(in_img),
            ]
        )
        identify = json.loads(subprocess.check_output(CONVERT + [str(in_img), "json:"]))
        assert len(identify) == 1
        # somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was
        # put into an array, here we cater for the older version containing just
        # the bare dictionary
        if "image" in identify:
            identify = [identify]
        assert "image" in identify[0]
        assert identify[0]["image"].get("format") == "TIFF", str(identify)
        assert identify[0]["image"].get("mimeType") == "image/tiff", str(identify)
        assert identify[0]["image"].get("geometry") == {
            "width": 60,
            "height": 60,
            "x": 0,
            "y": 0,
        }, str(identify)
        assert identify[0]["image"].get("colorspace") == "sRGB", 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", "LSB",], str(
            identify
        )  # FIXME: should be LSB
        if identify[0].get("version", "0") < "1.0":
            assert identify[0]["image"].get("depth") == 12, str(identify)
        else:
>           assert identify[0]["image"].get("depth") == 16, str(identify)
E           AssertionError: [{'version': '1.0', 'image': {'name': '/build/pytest-of-nixbld/pytest-0/tiff_rgb83/in.tiff', 'baseName': 'in.tiff', 'format': 'TIFF', 'formatDescription': 'TIFF', 'mimeType': 'image/tiff', 'class': 'DirectClass', 'geometry': {'width': 60, 'height': 60, 'x': 0, 'y': 0}, 'units': 'PixelsPerInch', 'type': 'TrueColor', 'endianness': 'LSB
', 'colorspace': 'sRGB', 'depth': 12, 'baseDepth': 12, 'channelDepth': {'red': 12, 'green': 12, 'blue': 1}, 'pixels': 10800, 'imageStatistics': {'Overall': {'min': 0, 'max': 4095.94, 'mean': 1195.62, 'median': 0, 'standardDeviation': 1707.91, 'kurtosis': -1.00122, 'skewness': 0.914892, 'entropy': 0.446271}}, 'channelStatistics': {'red': {'min': 0, 'max': 4095.94, 'mean': 1195.75, 
'median': 0, 'standardDeviation': 1707.47, 'kurtosis': -1.00107, 'skewness': 0.914908, 'entropy': 0.447488}, 'green': {'min': 0, 'max': 4095.94, 'mean': 1197.71, 'median': 0, 'standardDeviation': 1708.79, 'kurtosis': -1.00682, 'skewness': 0.912032, 'entropy': 0.446303}, 'blue': {'min': 0, 'max': 4095.94, 'mean': 1193.41, 'median': 0, 'standardDeviation': 1707.48, 'kurtosis': -0.99
7979, 'skewness': 0.916978, 'entropy': 0.445022}}, 'renderingIntent': 'Perceptual', 'gamma': 0.454545, 'chromaticity': {'redPrimary': {'x': 0.64, 'y': 0.33}, 'greenPrimary': {'x': 0.3, 'y': 0.6}, 'bluePrimary': {'x': 0.15, 'y': 0.06}, 'whitePrimary': {'x': 0.3127, 'y': 0.329}}, 'matteColor': '#BDBDBD', 'backgroundColor': '#FFFFFF', 'borderColor': '#DFDFDF', 'transparentColor': '#0
0000000', 'interlace': 'None', 'intensity': 'Undefined', 'compose': 'Over', 'pageGeometry': {'width': 60, 'height': 60, 'x': 0, 'y': 0}, 'dispose': 'Undefined', 'iterations': 0, 'compression': 'Zip', 'orientation': 'TopLeft', 'properties': {'signature': 'ab114596e3a7eed7e487e31ebdf5128417bc878e9847df01cb939f74802b12fd', 'tiff:alpha': 'unspecified', 'tiff:endian': 'lsb', 'tiff:phot
ometric': 'RGB', 'tiff:rows-per-strip': '60'}, 'tainted': False, 'filesize': '5214B', 'numberPixels': '3600', 'pixelsPerSecond': '4.78077MB', 'userTime': '0.000u', 'elapsedTime': '0:01.000', 'version': 'ImageMagick 7.1.0-48 Q16-HDRI x86_64 c1ca24765:20220910 https://imagemagick.org'}}]
E           assert 12 == 16
E            +  where 12 = <built-in method get of dict object at 0x7ffff5f09080>('depth')
E            +    where <built-in method get of dict object at 0x7ffff5f09080> = {'backgroundColor': '#FFFFFF', 'baseDepth': 12, 'baseName': 'in.tiff', 'borderColor': '#DFDFDF', ...}.get

src/img2pdf_test.py:2565: AssertionError
__________________ ERROR at setup of test_tiff_rgb12[pikepdf] __________________

tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7ffff6a50850>, _basetemp=PosixPath('/build/pytest-of-nixbld/pytest-0'))
tmp_normal16_png = PosixPath('/build/pytest-of-nixbld/pytest-0/normal16_png0/normal16.png')

    @pytest.fixture(scope="session")
    def tiff_rgb12_img(tmp_path_factory, tmp_normal16_png):
        in_img = tmp_path_factory.mktemp("tiff_rgb8") / "in.tiff"
        subprocess.check_call(
            CONVERT
            + [
                str(tmp_normal16_png),
                "-depth",
                "12",
                "-compress",
                "Zip",
                str(in_img),
            ]
        )
        identify = json.loads(subprocess.check_output(CONVERT + [str(in_img), "json:"]))
        assert len(identify) == 1
        # somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was
        # put into an array, here we cater for the older version containing just
        # the bare dictionary
        if "image" in identify:
            identify = [identify]
        assert "image" in identify[0]
        assert identify[0]["image"].get("format") == "TIFF", str(identify)
        assert identify[0]["image"].get("mimeType") == "image/tiff", str(identify)
        assert identify[0]["image"].get("geometry") == {
            "width": 60,
            "height": 60,
            "x": 0,
            "y": 0,
        }, str(identify)
        assert identify[0]["image"].get("colorspace") == "sRGB", 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", "LSB",], str(
            identify
        )  # FIXME: should be LSB
        if identify[0].get("version", "0") < "1.0":
            assert identify[0]["image"].get("depth") == 12, str(identify)
        else:
>           assert identify[0]["image"].get("depth") == 16, str(identify)
E           AssertionError: [{'version': '1.0', 'image': {'name': '/build/pytest-of-nixbld/pytest-0/tiff_rgb83/in.tiff', 'baseName': 'in.tiff', 'format': 'TIFF', 'formatDescription': 'TIFF', 'mimeType': 'image/tiff', 'class': 'DirectClass', 'geometry': {'width': 60, 'height': 60, 'x': 0, 'y': 0}, 'units': 'PixelsPerInch', 'type': 'TrueColor', 'endianness': 'LSB
', 'colorspace': 'sRGB', 'depth': 12, 'baseDepth': 12, 'channelDepth': {'red': 12, 'green': 12, 'blue': 1}, 'pixels': 10800, 'imageStatistics': {'Overall': {'min': 0, 'max': 4095.94, 'mean': 1195.62, 'median': 0, 'standardDeviation': 1707.91, 'kurtosis': -1.00122, 'skewness': 0.914892, 'entropy': 0.446271}}, 'channelStatistics': {'red': {'min': 0, 'max': 4095.94, 'mean': 1195.75, 
'median': 0, 'standardDeviation': 1707.47, 'kurtosis': -1.00107, 'skewness': 0.914908, 'entropy': 0.447488}, 'green': {'min': 0, 'max': 4095.94, 'mean': 1197.71, 'median': 0, 'standardDeviation': 1708.79, 'kurtosis': -1.00682, 'skewness': 0.912032, 'entropy': 0.446303}, 'blue': {'min': 0, 'max': 4095.94, 'mean': 1193.41, 'median': 0, 'standardDeviation': 1707.48, 'kurtosis': -0.99
7979, 'skewness': 0.916978, 'entropy': 0.445022}}, 'renderingIntent': 'Perceptual', 'gamma': 0.454545, 'chromaticity': {'redPrimary': {'x': 0.64, 'y': 0.33}, 'greenPrimary': {'x': 0.3, 'y': 0.6}, 'bluePrimary': {'x': 0.15, 'y': 0.06}, 'whitePrimary': {'x': 0.3127, 'y': 0.329}}, 'matteColor': '#BDBDBD', 'backgroundColor': '#FFFFFF', 'borderColor': '#DFDFDF', 'transparentColor': '#0
0000000', 'interlace': 'None', 'intensity': 'Undefined', 'compose': 'Over', 'pageGeometry': {'width': 60, 'height': 60, 'x': 0, 'y': 0}, 'dispose': 'Undefined', 'iterations': 0, 'compression': 'Zip', 'orientation': 'TopLeft', 'properties': {'signature': 'ab114596e3a7eed7e487e31ebdf5128417bc878e9847df01cb939f74802b12fd', 'tiff:alpha': 'unspecified', 'tiff:endian': 'lsb', 'tiff:phot
ometric': 'RGB', 'tiff:rows-per-strip': '60'}, 'tainted': False, 'filesize': '5214B', 'numberPixels': '3600', 'pixelsPerSecond': '4.78077MB', 'userTime': '0.000u', 'elapsedTime': '0:01.000', 'version': 'ImageMagick 7.1.0-48 Q16-HDRI x86_64 c1ca24765:20220910 https://imagemagick.org'}}]
E           assert 12 == 16
E            +  where 12 = <built-in method get of dict object at 0x7ffff5f09080>('depth')
E            +    where <built-in method get of dict object at 0x7ffff5f09080> = {'backgroundColor': '#FFFFFF', 'baseDepth': 12, 'baseName': 'in.tiff', 'borderColor': '#DFDFDF', ...}.get

src/img2pdf_test.py:2565: AssertionError
_________________ ERROR at setup of test_tiff_rgb14[internal] __________________

tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7ffff6a50850>, _basetemp=PosixPath('/build/pytest-of-nixbld/pytest-0'))
tmp_normal16_png = PosixPath('/build/pytest-of-nixbld/pytest-0/normal16_png0/normal16.png')

    @pytest.fixture(scope="session")
    def tiff_rgb14_img(tmp_path_factory, tmp_normal16_png):
        in_img = tmp_path_factory.mktemp("tiff_rgb8") / "in.tiff"
        subprocess.check_call(
            CONVERT
            + [
                str(tmp_normal16_png),
                "-depth",
                "14",
                "-compress",
                "Zip",
                str(in_img),
            ]
        )
        identify = json.loads(subprocess.check_output(CONVERT + [str(in_img), "json:"]))
        assert len(identify) == 1
        # somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was
        # put into an array, here we cater for the older version containing just
        # the bare dictionary
        if "image" in identify:
            identify = [identify]
        assert "image" in identify[0]
        assert identify[0]["image"].get("format") == "TIFF", str(identify)
        assert identify[0]["image"].get("mimeType") == "image/tiff", str(identify)
        assert identify[0]["image"].get("geometry") == {
            "width": 60,
            "height": 60,
            "x": 0,
            "y": 0,
        }, str(identify)
        assert identify[0]["image"].get("colorspace") == "sRGB", 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", "LSB",], str(
            identify
        )  # FIXME: should be LSB
>       assert identify[0]["image"].get("depth") == 16, str(identify)
E       AssertionError: [{'version': '1.0', 'image': {'name': '/build/pytest-of-nixbld/pytest-0/tiff_rgb84/in.tiff', 'baseName': 'in.tiff', 'format': 'TIFF', 'formatDescription': 'TIFF', 'mimeType': 'image/tiff', 'class': 'DirectClass', 'geometry': {'width': 60, 'height': 60, 'x': 0, 'y': 0}, 'units': 'PixelsPerInch', 'type': 'TrueColor', 'endianness': 'LSB', '
colorspace': 'sRGB', 'depth': 14, 'baseDepth': 14, 'channelDepth': {'red': 14, 'green': 14, 'blue': 1}, 'pixels': 10800, 'imageStatistics': {'Overall': {'min': 0, 'max': 16383.8, 'mean': 4782.56, 'median': 0, 'standardDeviation': 6831.69, 'kurtosis': -1.00124, 'skewness': 0.914883, 'entropy': 0.446271}}, 'channelStatistics': {'red': {'min': 0, 'max': 16383.8, 'mean': 4783.06, 'med
ian': 0, 'standardDeviation': 6829.89, 'kurtosis': -1.00108, 'skewness': 0.914899, 'entropy': 0.447488}, 'green': {'min': 0, 'max': 16383.8, 'mean': 4790.9, 'median': 0, 'standardDeviation': 6835.21, 'kurtosis': -1.00683, 'skewness': 0.912023, 'entropy': 0.446303}, 'blue': {'min': 0, 'max': 16383.8, 'mean': 4773.72, 'median': 0, 'standardDeviation': 6829.96, 'kurtosis': -0.997995,
 'skewness': 0.916969, 'entropy': 0.445022}}, 'renderingIntent': 'Perceptual', 'gamma': 0.454545, 'chromaticity': {'redPrimary': {'x': 0.64, 'y': 0.33}, 'greenPrimary': {'x': 0.3, 'y': 0.6}, 'bluePrimary': {'x': 0.15, 'y': 0.06}, 'whitePrimary': {'x': 0.3127, 'y': 0.329}}, 'matteColor': '#BDBDBD', 'backgroundColor': '#FFFFFF', 'borderColor': '#DFDFDF', 'transparentColor': '#000000
00', 'interlace': 'None', 'intensity': 'Undefined', 'compose': 'Over', 'pageGeometry': {'width': 60, 'height': 60, 'x': 0, 'y': 0}, 'dispose': 'Undefined', 'iterations': 0, 'compression': 'Zip', 'orientation': 'TopLeft', 'properties': {'signature': '4cfcfdeb7dd11983cb449d4cbc7b0e603012c9488fa4155b3f2187832d0954f9', 'tiff:alpha': 'unspecified', 'tiff:endian': 'lsb', 'tiff:photometr
ic': 'RGB', 'tiff:rows-per-strip': '60'}, 'tainted': False, 'filesize': '6328B', 'numberPixels': '3600', 'pixelsPerSecond': '4.36503MB', 'userTime': '0.000u', 'elapsedTime': '0:01.000', 'version': 'ImageMagick 7.1.0-48 Q16-HDRI x86_64 c1ca24765:20220910 https://imagemagick.org'}}]
E       assert 14 == 16
E        +  where 14 = <built-in method get of dict object at 0x7ffff5f413c0>('depth')
E        +    where <built-in method get of dict object at 0x7ffff5f413c0> = {'backgroundColor': '#FFFFFF', 'baseDepth': 14, 'baseName': 'in.tiff', 'borderColor': '#DFDFDF', ...}.get

src/img2pdf_test.py:2622: AssertionError
__________________ ERROR at setup of test_tiff_rgb14[pikepdf] __________________

tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7ffff6a50850>, _basetemp=PosixPath('/build/pytest-of-nixbld/pytest-0'))
tmp_normal16_png = PosixPath('/build/pytest-of-nixbld/pytest-0/normal16_png0/normal16.png')

    @pytest.fixture(scope="session")
    def tiff_rgb14_img(tmp_path_factory, tmp_normal16_png):
        in_img = tmp_path_factory.mktemp("tiff_rgb8") / "in.tiff"
        subprocess.check_call(
            CONVERT
            + [
                str(tmp_normal16_png),
                "-depth",
                "14",
                "-compress",
                "Zip",
                str(in_img),
            ]
        )
        identify = json.loads(subprocess.check_output(CONVERT + [str(in_img), "json:"]))
        assert len(identify) == 1
        # somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was
        # put into an array, here we cater for the older version containing just
        # the bare dictionary
        if "image" in identify:
            identify = [identify]
        assert "image" in identify[0]
        assert identify[0]["image"].get("format") == "TIFF", str(identify)
        assert identify[0]["image"].get("mimeType") == "image/tiff", str(identify)
        assert identify[0]["image"].get("geometry") == {
            "width": 60,
            "height": 60,
            "x": 0,
            "y": 0,
        }, str(identify)
        assert identify[0]["image"].get("colorspace") == "sRGB", 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", "LSB",], str(
            identify
        )  # FIXME: should be LSB
>       assert identify[0]["image"].get("depth") == 16, str(identify)
E       AssertionError: [{'version': '1.0', 'image': {'name': '/build/pytest-of-nixbld/pytest-0/tiff_rgb84/in.tiff', 'baseName': 'in.tiff', 'format': 'TIFF', 'formatDescription': 'TIFF', 'mimeType': 'image/tiff', 'class': 'DirectClass', 'geometry': {'width': 60, 'height': 60, 'x': 0, 'y': 0}, 'units': 'PixelsPerInch', 'type': 'TrueColor', 'endianness': 'LSB', '
colorspace': 'sRGB', 'depth': 14, 'baseDepth': 14, 'channelDepth': {'red': 14, 'green': 14, 'blue': 1}, 'pixels': 10800, 'imageStatistics': {'Overall': {'min': 0, 'max': 16383.8, 'mean': 4782.56, 'median': 0, 'standardDeviation': 6831.69, 'kurtosis': -1.00124, 'skewness': 0.914883, 'entropy': 0.446271}}, 'channelStatistics': {'red': {'min': 0, 'max': 16383.8, 'mean': 4783.06, 'med
ian': 0, 'standardDeviation': 6829.89, 'kurtosis': -1.00108, 'skewness': 0.914899, 'entropy': 0.447488}, 'green': {'min': 0, 'max': 16383.8, 'mean': 4790.9, 'median': 0, 'standardDeviation': 6835.21, 'kurtosis': -1.00683, 'skewness': 0.912023, 'entropy': 0.446303}, 'blue': {'min': 0, 'max': 16383.8, 'mean': 4773.72, 'median': 0, 'standardDeviation': 6829.96, 'kurtosis': -0.997995,
 'skewness': 0.916969, 'entropy': 0.445022}}, 'renderingIntent': 'Perceptual', 'gamma': 0.454545, 'chromaticity': {'redPrimary': {'x': 0.64, 'y': 0.33}, 'greenPrimary': {'x': 0.3, 'y': 0.6}, 'bluePrimary': {'x': 0.15, 'y': 0.06}, 'whitePrimary': {'x': 0.3127, 'y': 0.329}}, 'matteColor': '#BDBDBD', 'backgroundColor': '#FFFFFF', 'borderColor': '#DFDFDF', 'transparentColor': '#000000
00', 'interlace': 'None', 'intensity': 'Undefined', 'compose': 'Over', 'pageGeometry': {'width': 60, 'height': 60, 'x': 0, 'y': 0}, 'dispose': 'Undefined', 'iterations': 0, 'compression': 'Zip', 'orientation': 'TopLeft', 'properties': {'signature': '4cfcfdeb7dd11983cb449d4cbc7b0e603012c9488fa4155b3f2187832d0954f9', 'tiff:alpha': 'unspecified', 'tiff:endian': 'lsb', 'tiff:photometr
ic': 'RGB', 'tiff:rows-per-strip': '60'}, 'tainted': False, 'filesize': '6328B', 'numberPixels': '3600', 'pixelsPerSecond': '4.36503MB', 'userTime': '0.000u', 'elapsedTime': '0:01.000', 'version': 'ImageMagick 7.1.0-48 Q16-HDRI x86_64 c1ca24765:20220910 https://imagemagick.org'}}]
E       assert 14 == 16
E        +  where 14 = <built-in method get of dict object at 0x7ffff5f413c0>('depth')
E        +    where <built-in method get of dict object at 0x7ffff5f413c0> = {'backgroundColor': '#FFFFFF', 'baseDepth': 14, 'baseName': 'in.tiff', 'borderColor': '#DFDFDF', ...}.get

src/img2pdf_test.py:2622: AssertionError
=============================== warnings summary ===============================
src/img2pdf_test.py:120
  /build/img2pdf-0.4.4/src/img2pdf_test.py:120: UserWarning: imagemagick has no jpeg 2000 support, skipping certain checks...
    warnings.warn("imagemagick has no jpeg 2000 support, skipping certain checks...")

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
ERROR src/img2pdf_test.py::test_tiff_rgb12[internal] - AssertionError: [{'ver...
ERROR src/img2pdf_test.py::test_tiff_rgb12[pikepdf] - AssertionError: [{'vers...
ERROR src/img2pdf_test.py::test_tiff_rgb14[internal] - AssertionError: [{'ver...
ERROR src/img2pdf_test.py::test_tiff_rgb14[pikepdf] - AssertionError: [{'vers...
======== 293 passed, 4 skipped, 1 warning, 4 errors in 88.79s (0:01:28) ========
We disabled these two tests when we started running the test suite for img2pdf in 2022/01. ``` ============================= test session starts ============================== platform linux -- Python 3.10.6, pytest-7.1.2, pluggy-1.0.0 rootdir: /build/img2pdf-0.4.4 collected 301 items src/img2pdf_test.py ......ss................................ss.......... [ 17%] ..........EEEE.......................................................... [ 41%] ........................................................................ [ 65%] ........................................................................ [ 89%] ................................. [100%] ==================================== ERRORS ==================================== _________________ ERROR at setup of test_tiff_rgb12[internal] __________________ tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7ffff6a50850>, _basetemp=PosixPath('/build/pytest-of-nixbld/pytest-0')) tmp_normal16_png = PosixPath('/build/pytest-of-nixbld/pytest-0/normal16_png0/normal16.png') @pytest.fixture(scope="session") def tiff_rgb12_img(tmp_path_factory, tmp_normal16_png): in_img = tmp_path_factory.mktemp("tiff_rgb8") / "in.tiff" subprocess.check_call( CONVERT + [ str(tmp_normal16_png), "-depth", "12", "-compress", "Zip", str(in_img), ] ) identify = json.loads(subprocess.check_output(CONVERT + [str(in_img), "json:"])) assert len(identify) == 1 # somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was # put into an array, here we cater for the older version containing just # the bare dictionary if "image" in identify: identify = [identify] assert "image" in identify[0] assert identify[0]["image"].get("format") == "TIFF", str(identify) assert identify[0]["image"].get("mimeType") == "image/tiff", str(identify) assert identify[0]["image"].get("geometry") == { "width": 60, "height": 60, "x": 0, "y": 0, }, str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", 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", "LSB",], str( identify ) # FIXME: should be LSB if identify[0].get("version", "0") < "1.0": assert identify[0]["image"].get("depth") == 12, str(identify) else: > assert identify[0]["image"].get("depth") == 16, str(identify) E AssertionError: [{'version': '1.0', 'image': {'name': '/build/pytest-of-nixbld/pytest-0/tiff_rgb83/in.tiff', 'baseName': 'in.tiff', 'format': 'TIFF', 'formatDescription': 'TIFF', 'mimeType': 'image/tiff', 'class': 'DirectClass', 'geometry': {'width': 60, 'height': 60, 'x': 0, 'y': 0}, 'units': 'PixelsPerInch', 'type': 'TrueColor', 'endianness': 'LSB ', 'colorspace': 'sRGB', 'depth': 12, 'baseDepth': 12, 'channelDepth': {'red': 12, 'green': 12, 'blue': 1}, 'pixels': 10800, 'imageStatistics': {'Overall': {'min': 0, 'max': 4095.94, 'mean': 1195.62, 'median': 0, 'standardDeviation': 1707.91, 'kurtosis': -1.00122, 'skewness': 0.914892, 'entropy': 0.446271}}, 'channelStatistics': {'red': {'min': 0, 'max': 4095.94, 'mean': 1195.75, 'median': 0, 'standardDeviation': 1707.47, 'kurtosis': -1.00107, 'skewness': 0.914908, 'entropy': 0.447488}, 'green': {'min': 0, 'max': 4095.94, 'mean': 1197.71, 'median': 0, 'standardDeviation': 1708.79, 'kurtosis': -1.00682, 'skewness': 0.912032, 'entropy': 0.446303}, 'blue': {'min': 0, 'max': 4095.94, 'mean': 1193.41, 'median': 0, 'standardDeviation': 1707.48, 'kurtosis': -0.99 7979, 'skewness': 0.916978, 'entropy': 0.445022}}, 'renderingIntent': 'Perceptual', 'gamma': 0.454545, 'chromaticity': {'redPrimary': {'x': 0.64, 'y': 0.33}, 'greenPrimary': {'x': 0.3, 'y': 0.6}, 'bluePrimary': {'x': 0.15, 'y': 0.06}, 'whitePrimary': {'x': 0.3127, 'y': 0.329}}, 'matteColor': '#BDBDBD', 'backgroundColor': '#FFFFFF', 'borderColor': '#DFDFDF', 'transparentColor': '#0 0000000', 'interlace': 'None', 'intensity': 'Undefined', 'compose': 'Over', 'pageGeometry': {'width': 60, 'height': 60, 'x': 0, 'y': 0}, 'dispose': 'Undefined', 'iterations': 0, 'compression': 'Zip', 'orientation': 'TopLeft', 'properties': {'signature': 'ab114596e3a7eed7e487e31ebdf5128417bc878e9847df01cb939f74802b12fd', 'tiff:alpha': 'unspecified', 'tiff:endian': 'lsb', 'tiff:phot ometric': 'RGB', 'tiff:rows-per-strip': '60'}, 'tainted': False, 'filesize': '5214B', 'numberPixels': '3600', 'pixelsPerSecond': '4.78077MB', 'userTime': '0.000u', 'elapsedTime': '0:01.000', 'version': 'ImageMagick 7.1.0-48 Q16-HDRI x86_64 c1ca24765:20220910 https://imagemagick.org'}}] E assert 12 == 16 E + where 12 = <built-in method get of dict object at 0x7ffff5f09080>('depth') E + where <built-in method get of dict object at 0x7ffff5f09080> = {'backgroundColor': '#FFFFFF', 'baseDepth': 12, 'baseName': 'in.tiff', 'borderColor': '#DFDFDF', ...}.get src/img2pdf_test.py:2565: AssertionError __________________ ERROR at setup of test_tiff_rgb12[pikepdf] __________________ tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7ffff6a50850>, _basetemp=PosixPath('/build/pytest-of-nixbld/pytest-0')) tmp_normal16_png = PosixPath('/build/pytest-of-nixbld/pytest-0/normal16_png0/normal16.png') @pytest.fixture(scope="session") def tiff_rgb12_img(tmp_path_factory, tmp_normal16_png): in_img = tmp_path_factory.mktemp("tiff_rgb8") / "in.tiff" subprocess.check_call( CONVERT + [ str(tmp_normal16_png), "-depth", "12", "-compress", "Zip", str(in_img), ] ) identify = json.loads(subprocess.check_output(CONVERT + [str(in_img), "json:"])) assert len(identify) == 1 # somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was # put into an array, here we cater for the older version containing just # the bare dictionary if "image" in identify: identify = [identify] assert "image" in identify[0] assert identify[0]["image"].get("format") == "TIFF", str(identify) assert identify[0]["image"].get("mimeType") == "image/tiff", str(identify) assert identify[0]["image"].get("geometry") == { "width": 60, "height": 60, "x": 0, "y": 0, }, str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", 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", "LSB",], str( identify ) # FIXME: should be LSB if identify[0].get("version", "0") < "1.0": assert identify[0]["image"].get("depth") == 12, str(identify) else: > assert identify[0]["image"].get("depth") == 16, str(identify) E AssertionError: [{'version': '1.0', 'image': {'name': '/build/pytest-of-nixbld/pytest-0/tiff_rgb83/in.tiff', 'baseName': 'in.tiff', 'format': 'TIFF', 'formatDescription': 'TIFF', 'mimeType': 'image/tiff', 'class': 'DirectClass', 'geometry': {'width': 60, 'height': 60, 'x': 0, 'y': 0}, 'units': 'PixelsPerInch', 'type': 'TrueColor', 'endianness': 'LSB ', 'colorspace': 'sRGB', 'depth': 12, 'baseDepth': 12, 'channelDepth': {'red': 12, 'green': 12, 'blue': 1}, 'pixels': 10800, 'imageStatistics': {'Overall': {'min': 0, 'max': 4095.94, 'mean': 1195.62, 'median': 0, 'standardDeviation': 1707.91, 'kurtosis': -1.00122, 'skewness': 0.914892, 'entropy': 0.446271}}, 'channelStatistics': {'red': {'min': 0, 'max': 4095.94, 'mean': 1195.75, 'median': 0, 'standardDeviation': 1707.47, 'kurtosis': -1.00107, 'skewness': 0.914908, 'entropy': 0.447488}, 'green': {'min': 0, 'max': 4095.94, 'mean': 1197.71, 'median': 0, 'standardDeviation': 1708.79, 'kurtosis': -1.00682, 'skewness': 0.912032, 'entropy': 0.446303}, 'blue': {'min': 0, 'max': 4095.94, 'mean': 1193.41, 'median': 0, 'standardDeviation': 1707.48, 'kurtosis': -0.99 7979, 'skewness': 0.916978, 'entropy': 0.445022}}, 'renderingIntent': 'Perceptual', 'gamma': 0.454545, 'chromaticity': {'redPrimary': {'x': 0.64, 'y': 0.33}, 'greenPrimary': {'x': 0.3, 'y': 0.6}, 'bluePrimary': {'x': 0.15, 'y': 0.06}, 'whitePrimary': {'x': 0.3127, 'y': 0.329}}, 'matteColor': '#BDBDBD', 'backgroundColor': '#FFFFFF', 'borderColor': '#DFDFDF', 'transparentColor': '#0 0000000', 'interlace': 'None', 'intensity': 'Undefined', 'compose': 'Over', 'pageGeometry': {'width': 60, 'height': 60, 'x': 0, 'y': 0}, 'dispose': 'Undefined', 'iterations': 0, 'compression': 'Zip', 'orientation': 'TopLeft', 'properties': {'signature': 'ab114596e3a7eed7e487e31ebdf5128417bc878e9847df01cb939f74802b12fd', 'tiff:alpha': 'unspecified', 'tiff:endian': 'lsb', 'tiff:phot ometric': 'RGB', 'tiff:rows-per-strip': '60'}, 'tainted': False, 'filesize': '5214B', 'numberPixels': '3600', 'pixelsPerSecond': '4.78077MB', 'userTime': '0.000u', 'elapsedTime': '0:01.000', 'version': 'ImageMagick 7.1.0-48 Q16-HDRI x86_64 c1ca24765:20220910 https://imagemagick.org'}}] E assert 12 == 16 E + where 12 = <built-in method get of dict object at 0x7ffff5f09080>('depth') E + where <built-in method get of dict object at 0x7ffff5f09080> = {'backgroundColor': '#FFFFFF', 'baseDepth': 12, 'baseName': 'in.tiff', 'borderColor': '#DFDFDF', ...}.get src/img2pdf_test.py:2565: AssertionError _________________ ERROR at setup of test_tiff_rgb14[internal] __________________ tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7ffff6a50850>, _basetemp=PosixPath('/build/pytest-of-nixbld/pytest-0')) tmp_normal16_png = PosixPath('/build/pytest-of-nixbld/pytest-0/normal16_png0/normal16.png') @pytest.fixture(scope="session") def tiff_rgb14_img(tmp_path_factory, tmp_normal16_png): in_img = tmp_path_factory.mktemp("tiff_rgb8") / "in.tiff" subprocess.check_call( CONVERT + [ str(tmp_normal16_png), "-depth", "14", "-compress", "Zip", str(in_img), ] ) identify = json.loads(subprocess.check_output(CONVERT + [str(in_img), "json:"])) assert len(identify) == 1 # somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was # put into an array, here we cater for the older version containing just # the bare dictionary if "image" in identify: identify = [identify] assert "image" in identify[0] assert identify[0]["image"].get("format") == "TIFF", str(identify) assert identify[0]["image"].get("mimeType") == "image/tiff", str(identify) assert identify[0]["image"].get("geometry") == { "width": 60, "height": 60, "x": 0, "y": 0, }, str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", 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", "LSB",], str( identify ) # FIXME: should be LSB > assert identify[0]["image"].get("depth") == 16, str(identify) E AssertionError: [{'version': '1.0', 'image': {'name': '/build/pytest-of-nixbld/pytest-0/tiff_rgb84/in.tiff', 'baseName': 'in.tiff', 'format': 'TIFF', 'formatDescription': 'TIFF', 'mimeType': 'image/tiff', 'class': 'DirectClass', 'geometry': {'width': 60, 'height': 60, 'x': 0, 'y': 0}, 'units': 'PixelsPerInch', 'type': 'TrueColor', 'endianness': 'LSB', ' colorspace': 'sRGB', 'depth': 14, 'baseDepth': 14, 'channelDepth': {'red': 14, 'green': 14, 'blue': 1}, 'pixels': 10800, 'imageStatistics': {'Overall': {'min': 0, 'max': 16383.8, 'mean': 4782.56, 'median': 0, 'standardDeviation': 6831.69, 'kurtosis': -1.00124, 'skewness': 0.914883, 'entropy': 0.446271}}, 'channelStatistics': {'red': {'min': 0, 'max': 16383.8, 'mean': 4783.06, 'med ian': 0, 'standardDeviation': 6829.89, 'kurtosis': -1.00108, 'skewness': 0.914899, 'entropy': 0.447488}, 'green': {'min': 0, 'max': 16383.8, 'mean': 4790.9, 'median': 0, 'standardDeviation': 6835.21, 'kurtosis': -1.00683, 'skewness': 0.912023, 'entropy': 0.446303}, 'blue': {'min': 0, 'max': 16383.8, 'mean': 4773.72, 'median': 0, 'standardDeviation': 6829.96, 'kurtosis': -0.997995, 'skewness': 0.916969, 'entropy': 0.445022}}, 'renderingIntent': 'Perceptual', 'gamma': 0.454545, 'chromaticity': {'redPrimary': {'x': 0.64, 'y': 0.33}, 'greenPrimary': {'x': 0.3, 'y': 0.6}, 'bluePrimary': {'x': 0.15, 'y': 0.06}, 'whitePrimary': {'x': 0.3127, 'y': 0.329}}, 'matteColor': '#BDBDBD', 'backgroundColor': '#FFFFFF', 'borderColor': '#DFDFDF', 'transparentColor': '#000000 00', 'interlace': 'None', 'intensity': 'Undefined', 'compose': 'Over', 'pageGeometry': {'width': 60, 'height': 60, 'x': 0, 'y': 0}, 'dispose': 'Undefined', 'iterations': 0, 'compression': 'Zip', 'orientation': 'TopLeft', 'properties': {'signature': '4cfcfdeb7dd11983cb449d4cbc7b0e603012c9488fa4155b3f2187832d0954f9', 'tiff:alpha': 'unspecified', 'tiff:endian': 'lsb', 'tiff:photometr ic': 'RGB', 'tiff:rows-per-strip': '60'}, 'tainted': False, 'filesize': '6328B', 'numberPixels': '3600', 'pixelsPerSecond': '4.36503MB', 'userTime': '0.000u', 'elapsedTime': '0:01.000', 'version': 'ImageMagick 7.1.0-48 Q16-HDRI x86_64 c1ca24765:20220910 https://imagemagick.org'}}] E assert 14 == 16 E + where 14 = <built-in method get of dict object at 0x7ffff5f413c0>('depth') E + where <built-in method get of dict object at 0x7ffff5f413c0> = {'backgroundColor': '#FFFFFF', 'baseDepth': 14, 'baseName': 'in.tiff', 'borderColor': '#DFDFDF', ...}.get src/img2pdf_test.py:2622: AssertionError __________________ ERROR at setup of test_tiff_rgb14[pikepdf] __________________ tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=<pluggy._tracing.TagTracerSub object at 0x7ffff6a50850>, _basetemp=PosixPath('/build/pytest-of-nixbld/pytest-0')) tmp_normal16_png = PosixPath('/build/pytest-of-nixbld/pytest-0/normal16_png0/normal16.png') @pytest.fixture(scope="session") def tiff_rgb14_img(tmp_path_factory, tmp_normal16_png): in_img = tmp_path_factory.mktemp("tiff_rgb8") / "in.tiff" subprocess.check_call( CONVERT + [ str(tmp_normal16_png), "-depth", "14", "-compress", "Zip", str(in_img), ] ) identify = json.loads(subprocess.check_output(CONVERT + [str(in_img), "json:"])) assert len(identify) == 1 # somewhere between imagemagick 6.9.7.4 and 6.9.9.34, the json output was # put into an array, here we cater for the older version containing just # the bare dictionary if "image" in identify: identify = [identify] assert "image" in identify[0] assert identify[0]["image"].get("format") == "TIFF", str(identify) assert identify[0]["image"].get("mimeType") == "image/tiff", str(identify) assert identify[0]["image"].get("geometry") == { "width": 60, "height": 60, "x": 0, "y": 0, }, str(identify) assert identify[0]["image"].get("colorspace") == "sRGB", 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", "LSB",], str( identify ) # FIXME: should be LSB > assert identify[0]["image"].get("depth") == 16, str(identify) E AssertionError: [{'version': '1.0', 'image': {'name': '/build/pytest-of-nixbld/pytest-0/tiff_rgb84/in.tiff', 'baseName': 'in.tiff', 'format': 'TIFF', 'formatDescription': 'TIFF', 'mimeType': 'image/tiff', 'class': 'DirectClass', 'geometry': {'width': 60, 'height': 60, 'x': 0, 'y': 0}, 'units': 'PixelsPerInch', 'type': 'TrueColor', 'endianness': 'LSB', ' colorspace': 'sRGB', 'depth': 14, 'baseDepth': 14, 'channelDepth': {'red': 14, 'green': 14, 'blue': 1}, 'pixels': 10800, 'imageStatistics': {'Overall': {'min': 0, 'max': 16383.8, 'mean': 4782.56, 'median': 0, 'standardDeviation': 6831.69, 'kurtosis': -1.00124, 'skewness': 0.914883, 'entropy': 0.446271}}, 'channelStatistics': {'red': {'min': 0, 'max': 16383.8, 'mean': 4783.06, 'med ian': 0, 'standardDeviation': 6829.89, 'kurtosis': -1.00108, 'skewness': 0.914899, 'entropy': 0.447488}, 'green': {'min': 0, 'max': 16383.8, 'mean': 4790.9, 'median': 0, 'standardDeviation': 6835.21, 'kurtosis': -1.00683, 'skewness': 0.912023, 'entropy': 0.446303}, 'blue': {'min': 0, 'max': 16383.8, 'mean': 4773.72, 'median': 0, 'standardDeviation': 6829.96, 'kurtosis': -0.997995, 'skewness': 0.916969, 'entropy': 0.445022}}, 'renderingIntent': 'Perceptual', 'gamma': 0.454545, 'chromaticity': {'redPrimary': {'x': 0.64, 'y': 0.33}, 'greenPrimary': {'x': 0.3, 'y': 0.6}, 'bluePrimary': {'x': 0.15, 'y': 0.06}, 'whitePrimary': {'x': 0.3127, 'y': 0.329}}, 'matteColor': '#BDBDBD', 'backgroundColor': '#FFFFFF', 'borderColor': '#DFDFDF', 'transparentColor': '#000000 00', 'interlace': 'None', 'intensity': 'Undefined', 'compose': 'Over', 'pageGeometry': {'width': 60, 'height': 60, 'x': 0, 'y': 0}, 'dispose': 'Undefined', 'iterations': 0, 'compression': 'Zip', 'orientation': 'TopLeft', 'properties': {'signature': '4cfcfdeb7dd11983cb449d4cbc7b0e603012c9488fa4155b3f2187832d0954f9', 'tiff:alpha': 'unspecified', 'tiff:endian': 'lsb', 'tiff:photometr ic': 'RGB', 'tiff:rows-per-strip': '60'}, 'tainted': False, 'filesize': '6328B', 'numberPixels': '3600', 'pixelsPerSecond': '4.36503MB', 'userTime': '0.000u', 'elapsedTime': '0:01.000', 'version': 'ImageMagick 7.1.0-48 Q16-HDRI x86_64 c1ca24765:20220910 https://imagemagick.org'}}] E assert 14 == 16 E + where 14 = <built-in method get of dict object at 0x7ffff5f413c0>('depth') E + where <built-in method get of dict object at 0x7ffff5f413c0> = {'backgroundColor': '#FFFFFF', 'baseDepth': 14, 'baseName': 'in.tiff', 'borderColor': '#DFDFDF', ...}.get src/img2pdf_test.py:2622: AssertionError =============================== warnings summary =============================== src/img2pdf_test.py:120 /build/img2pdf-0.4.4/src/img2pdf_test.py:120: UserWarning: imagemagick has no jpeg 2000 support, skipping certain checks... warnings.warn("imagemagick has no jpeg 2000 support, skipping certain checks...") -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ ERROR src/img2pdf_test.py::test_tiff_rgb12[internal] - AssertionError: [{'ver... ERROR src/img2pdf_test.py::test_tiff_rgb12[pikepdf] - AssertionError: [{'vers... ERROR src/img2pdf_test.py::test_tiff_rgb14[internal] - AssertionError: [{'ver... ERROR src/img2pdf_test.py::test_tiff_rgb14[pikepdf] - AssertionError: [{'vers... ======== 293 passed, 4 skipped, 1 warning, 4 errors in 88.79s (0:01:28) ======== ```
Owner

Maybe this is just a bug in my (old) imagemagick version but with imagemagick 6.9.11.60 the depth attribute for 12 or 14 bit tiff files (wrongly) reports as 16. Maybe it makes sense to just relax this test like this:

EDIT

Nah, lets just drop this test because we already check baseDepth.

diff --git a/src/img2pdf_test.py b/src/img2pdf_test.py
index a98d2de..00e5176 100755
--- a/src/img2pdf_test.py
+++ b/src/img2pdf_test.py
@@ -2559,10 +2559,6 @@ def tiff_rgb12_img(tmp_path_factory, tmp_normal16_png):
     assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
         identify
     )  # FIXME: should be LSB
-    if identify[0].get("version", "0") < "1.0":
-        assert identify[0]["image"].get("depth") == 12, str(identify)
-    else:
-        assert identify[0]["image"].get("depth") == 16, str(identify)
     assert identify[0]["image"].get("baseDepth") == 12, str(identify)
     assert identify[0]["image"].get("pageGeometry") == {
         "width": 60,
@@ -2619,7 +2615,6 @@ def tiff_rgb14_img(tmp_path_factory, tmp_normal16_png):
     assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str(
         identify
     )  # FIXME: should be LSB
-    assert identify[0]["image"].get("depth") == 16, str(identify)
     assert identify[0]["image"].get("baseDepth") == 14, str(identify)
     assert identify[0]["image"].get("pageGeometry") == {
         "width": 60,
Maybe this is just a bug in my (old) imagemagick version but with imagemagick 6.9.11.60 the depth attribute for 12 or 14 bit tiff files (wrongly) reports as 16. Maybe it makes sense to just relax this test like this: **EDIT** Nah, lets just drop this test because we already check `baseDepth`. ```patch diff --git a/src/img2pdf_test.py b/src/img2pdf_test.py index a98d2de..00e5176 100755 --- a/src/img2pdf_test.py +++ b/src/img2pdf_test.py @@ -2559,10 +2559,6 @@ def tiff_rgb12_img(tmp_path_factory, tmp_normal16_png): assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str( identify ) # FIXME: should be LSB - if identify[0].get("version", "0") < "1.0": - assert identify[0]["image"].get("depth") == 12, str(identify) - else: - assert identify[0]["image"].get("depth") == 16, str(identify) assert identify[0]["image"].get("baseDepth") == 12, str(identify) assert identify[0]["image"].get("pageGeometry") == { "width": 60, @@ -2619,7 +2615,6 @@ def tiff_rgb14_img(tmp_path_factory, tmp_normal16_png): assert identify[0]["image"].get(endian) in ["Undefined", "LSB",], str( identify ) # FIXME: should be LSB - assert identify[0]["image"].get("depth") == 16, str(identify) assert identify[0]["image"].get("baseDepth") == 14, str(identify) assert identify[0]["image"].get("pageGeometry") == { "width": 60, ```
Owner

@sbraz, @hexa could one of you please verify whether the patch in my last message fixes this issue, thanks!

@sbraz, @hexa could one of you please verify whether the patch in my last message fixes this issue, thanks!

Works for us. Thanks!

Works for us. Thanks!
josch closed this issue 2022-09-23 21:11:11 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: josch/img2pdf#119
No description provided.