Tests fail with ImageMagick compiled with --with-quantum-depth=8 or 32 #120

Open
opened 2021-08-22 23:31:36 +00:00 by sbraz · 18 comments
Contributor

I think it's better to open a separate issue for that. I don't really understand how that setting manages to affect tests. I had the same suspicion as you but I think (not 100% sure) that I tested identify against the same PNG file and it always showed the right depth. I decided that I would just prevent tests from running with something other than the default quantum depth of 16 and that was it.

Does the test suite at some point use ImageMagick to create new files? In that case, maybe this setting affects the depth of the created files?

I am attaching logs from builds with both variants. I noticed that the quantum depth appears in the version string: ImageMagick 7.1.0-4 Q32 x86_64 2021-07-18.

The Q8 version seems to fail a lot of tests whereas the Q32 is not as bad.

I think it's better to open a separate issue for that. I don't really understand how that setting manages to affect tests. I had the same suspicion as you but I think (not 100% sure) that I tested `identify` against the same PNG file and it always showed the right depth. I decided that I would just prevent tests from running with something other than the default quantum depth of 16 and that was it. Does the test suite at some point use ImageMagick to create new files? In that case, maybe this setting affects the depth of the created files? I am attaching logs from builds with both variants. I noticed that the quantum depth appears in the version string: _ImageMagick 7.1.0-4 **Q32** x86_64 2021-07-18_. The Q8 version seems to fail a lot of tests whereas the Q32 is not as bad.
Owner

Does the test suite at some point use ImageMagick to create new files? In that case, maybe this setting affects the depth of the created files?

Yes, I'm using the convert tool from imagemagick to create most of the test input. That's why I'm checking the bit depth everywhere, to be sure that the test input I create is the input I expect it to be.

I am attaching logs from builds with both variants. I noticed that the quantum depth appears in the version string: ImageMagick 7.1.0-4 Q32 x86_64 2021-07-18.

The Q8 version seems to fail a lot of tests whereas the Q32 is not as bad.

That makes sense, because there are a lot of tests that expect imagemagick to handle 16bit depth which will probably fail with Q8 but work fine with Q32.

> Does the test suite at some point use ImageMagick to create new files? In that case, maybe this setting affects the depth of the created files? Yes, I'm using the `convert` tool from imagemagick to create most of the test input. That's why I'm checking the bit depth everywhere, to be sure that the test input I create is the input I expect it to be. > I am attaching logs from builds with both variants. I noticed that the quantum depth appears in the version string: _ImageMagick 7.1.0-4 **Q32** x86_64 2021-07-18_. > > The Q8 version seems to fail a lot of tests whereas the Q32 is not as bad. That makes sense, because there are a lot of tests that expect imagemagick to handle 16bit depth which will probably fail with Q8 but work fine with Q32.
Author
Contributor

I can confirm that the depth attribute contains the compile-time constant quantum depth for TIFF images whereas baseDepth contains the actual depth (but for PNG or JPG, both attributes contain the actual depth, go figure 😕). What we should probably do is drop all lines where depth is checked, replacing it with baseDepth if it is not checked.

This way, tests would pass with Q32 (I think the failures on Q8 should just be ignored, I doubt anyone will have IM built with it and if they want working tests, they just need to skip those that require 16 bit depth).

What is the minimum IM version you want to support (in other words, what Debian/Ubuntu version)? If I change the tests, I want to make sure that they don't break on older versions.

I can confirm that the `depth` attribute contains the compile-time constant quantum depth for TIFF images whereas `baseDepth` contains the actual depth (but for PNG or JPG, both attributes contain the actual depth, go figure 😕). What we should probably do is drop all lines where `depth` is checked, replacing it with `baseDepth` if it is not checked. This way, tests would pass with Q32 (I think the failures on Q8 should just be ignored, I doubt anyone will have IM built with it and if they want working tests, they just need to skip those that require 16 bit depth). What is the minimum IM version you want to support (in other words, what Debian/Ubuntu version)? If I change the tests, I want to make sure that they don't break on older versions.
Author
Contributor

Well tests fail with Python 3.5 because of a str/bytes thing so I guess the minimum version will be Focal with 3.6.

Well tests fail with Python 3.5 because of a str/bytes thing so I guess the minimum version will be Focal with 3.6.
Contributor

Unless I'm very much mistaken, Focal ships Python 3.8

Unless I'm very much mistaken, Focal ships Python 3.8
Author
Contributor

My bad, I meant Bionic.

My bad, I meant Bionic.
Owner

I can confirm that the depth attribute contains the compile-time constant quantum depth for TIFF images whereas baseDepth contains the actual depth (but for PNG or JPG, both attributes contain the actual depth, go figure 😕). What we should probably do is drop all lines where depth is checked, replacing it with baseDepth if it is not checked.

Yes, that sounds reasonable.

This way, tests would pass with Q32 (I think the failures on Q8 should just be ignored, I doubt anyone will have IM built with it and if they want working tests, they just need to skip those that require 16 bit depth).

What is the minimum IM version you want to support (in other words, what Debian/Ubuntu version)? If I change the tests, I want to make sure that they don't break on older versions.

I'm a Debian user which currently only ships 6.9.11.60. I have no idea what the current status of the transition to version 7 is, which would then also land in Ubuntu. I'm a Debian Developer and can help the packaging effort and offered my help in the relevant bug report: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=929825

Personally I have little issue with just requiring IM7 and call it a day. This would also push me to put some work into finally having IM7 in Debian (and thus later also Ubuntu). But I guess too many people will be using old Ubuntu LTS versions for a while so I fear that we will continue being stuck on having to support IM 6.9.7.4 which is the version in Ubuntu Bionic, the last supported LTS.

> I can confirm that the `depth` attribute contains the compile-time constant quantum depth for TIFF images whereas `baseDepth` contains the actual depth (but for PNG or JPG, both attributes contain the actual depth, go figure 😕). What we should probably do is drop all lines where `depth` is checked, replacing it with `baseDepth` if it is not checked. Yes, that sounds reasonable. > This way, tests would pass with Q32 (I think the failures on Q8 should just be ignored, I doubt anyone will have IM built with it and if they want working tests, they just need to skip those that require 16 bit depth). > > What is the minimum IM version you want to support (in other words, what Debian/Ubuntu version)? If I change the tests, I want to make sure that they don't break on older versions. I'm a Debian user which currently only ships 6.9.11.60. I have no idea what the current status of the transition to version 7 is, which would then also land in Ubuntu. I'm a Debian Developer and can help the packaging effort and offered my help in the relevant bug report: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=929825 Personally I have little issue with just requiring IM7 and call it a day. This would also push me to put some work into *finally* having IM7 in Debian (and thus later also Ubuntu). But I guess too many people will be using old Ubuntu LTS versions for a while so I fear that we will continue being stuck on having to support IM 6.9.7.4 which is the version in Ubuntu Bionic, the last supported LTS.
josch closed this issue 2021-08-23 20:53:17 +00:00
Owner

Whoops, clicked the close button by mistake.

Whoops, clicked the close button by mistake.
josch reopened this issue 2021-08-23 20:54:23 +00:00
Contributor

Updating ImageMagick to version 7 in Debian (and subsequently in Ubuntu) would be nice. I'm having some strange issues converting svg to ico that apparently got fixed with IM7 (https://github.com/cfcurtis/pdfstitcher/pull/96, https://github.com/cfcurtis/pdfstitcher/pull/101).

Updating ImageMagick to version 7 in Debian (and subsequently in Ubuntu) would be nice. I'm having some strange issues converting svg to ico that apparently got fixed with IM7 (https://github.com/cfcurtis/pdfstitcher/pull/96, https://github.com/cfcurtis/pdfstitcher/pull/101).
Author
Contributor

I'm a Debian Developer and can help the packaging effort and offered my help in the relevant bug report

Good to know, in that case maybe the next Ubuntu version will have IM 7 at least.

I tried replacing depth with baseDepth everywhere but it breaks some tests. Not all TIFF files behave the same way so I opened an IM issue: https://github.com/ImageMagick/ImageMagick/issues/4109.

> I'm a Debian Developer and can help the packaging effort and offered my help in the relevant bug report Good to know, in that case maybe the next Ubuntu version will have IM 7 at least. I tried replacing depth with baseDepth everywhere but it breaks some tests. Not all TIFF files behave the same way so I opened an IM issue: https://github.com/ImageMagick/ImageMagick/issues/4109.
Author
Contributor

@josch I don't know if you followed the issue I opened but it sounds like you should indeed stop testing the value of depth.

@josch I don't know if you followed the issue I opened but it sounds like you should indeed stop testing the value of `depth`.
Owner

@sbraz do you have imagemagick 7 on gentoo? I just installed 7.1.0.5 and adapted the tests so that they work with IM7. I'm pondering to drop IM6 support because of all the differences in the output depending on the minor version.

@sbraz do you have imagemagick 7 on gentoo? I just installed 7.1.0.5 and adapted the tests so that they work with IM7. I'm pondering to drop IM6 support because of all the differences in the output depending on the minor version.
Author
Contributor

@josch I do have IM7 and with the commits I pushed to main, the tests pass fine. Are you seeing additional failures?

@josch I do have IM7 and with the commits I pushed to main, the tests pass fine. Are you seeing additional failures?
Owner

Which commits are you refering to?

Currently, with IM7, the tests pass fine for me locally. Unfortunately, this breaks the Travis tests because those still use Ubuntu which only has IM6 available. But I don't have enough time to maintain compatibility with multiple IM versions, so I thought I just make it work with the lastest and call it a day.

Which commits are you refering to? Currently, with IM7, the tests pass fine for me locally. Unfortunately, this breaks the Travis tests because those still use Ubuntu which only has IM6 available. But I don't have enough time to maintain compatibility with multiple IM versions, so I thought I just make it work with the lastest and call it a day.
Author
Contributor

I meant all the commits from #117

Those made the tests work with both IM6 and IM7. I am surprised that tests fail on Travis but I am pretty sure this is unrelated to the changes because they failed before I started adding commits for IM7.

I have probably provided example Dockerfiles in other issues to run the test suite on Debian Bullseye and other OSes but I don't remember everything now.

I don't mind you dropping support for older IM versions but I'm not sure how Debian/Ubuntu users will feel about this change.

I meant all the commits from https://gitlab.mister-muffin.de/josch/img2pdf/pulls/117 Those made the tests work with both IM6 and IM7. I am surprised that tests fail on Travis but I am pretty sure this is unrelated to the changes because they failed before I started adding commits for IM7. I have probably provided example Dockerfiles in other issues to run the test suite on Debian Bullseye and other OSes but I don't remember everything now. I don't mind you dropping support for older IM versions but I'm not sure how Debian/Ubuntu users will feel about this change.
Owner

I don't mind you dropping support for older IM versions but I'm not sure how Debian/Ubuntu users will feel about this change.

Luckily, I'm the Debian maintainer of img2pdf so I can adjust things there as needed.

To come back to the original topic of this issue: Do you also have patches for img2pdf to run the tests with imagemagick with a quantum depth other than 16?

> I don't mind you dropping support for older IM versions but I'm not sure how Debian/Ubuntu users will feel about this change. Luckily, I'm the Debian maintainer of img2pdf so I can adjust things there as needed. To come back to the original topic of this issue: Do you also have patches for img2pdf to run the tests with imagemagick with a quantum depth other than 16?
Author
Contributor

Luckily, I'm the Debian maintainer of img2pdf so I can adjust things there as needed.

Well if you can make Debian switch to IM7, that'd be cool :) I just don't realise how much work that represents.

Do you also have patches for img2pdf to run the tests with imagemagick with a quantum depth other than 16?

I do not. I don't think it is worth the trouble since Q8 and Q32 builds seem rare. Q8 will probably not work as expected with most tests so I'd skip it.

As for Q32, you can probably store the value of the build's quantum-depth and reuse it in tests. From what the IM maintainer explained, I'm not sure if the behaviour we're seeing might change some day. Maybe we should skip the bit depth tests for the problematic files, I don't really know :/

> Luckily, I'm the Debian maintainer of img2pdf so I can adjust things there as needed. Well if you can make Debian switch to IM7, that'd be cool :) I just don't realise how much work that represents. > Do you also have patches for img2pdf to run the tests with imagemagick with a quantum depth other than 16? I do not. I don't think it is worth the trouble since Q8 and Q32 builds seem rare. Q8 will probably not work as expected with most tests so I'd skip it. As for Q32, you can probably store the value of the build's quantum-depth and reuse it in tests. [From what the IM maintainer explained](https://github.com/ImageMagick/ImageMagick/issues/4109#issuecomment-911545853), I'm not sure if the behaviour we're seeing might change some day. Maybe we should skip the bit depth tests for the problematic files, I don't really know :/
Owner

@sbraz, did 10c6901fa3 maybe also fix this one?

@sbraz, did 10c6901fa3e4ff02c18a476d5984ee81c56654a1 maybe also fix this one?
Author
Contributor

Hi @josch. It's been a while since I last used the package. I'll try to look into it.

Hi @josch. It's been a while since I last used the package. I'll try to look into it.
josch added the
question
label 2023-06-11 12:52:40 +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#120
No description provided.