Commit c46636d
committed
Fixes broken test_orientation test for ImageMagick backend
So, from what I can tell, the test is failing on ImageMagick 6.9.12.98
(Ubuntu 24.04), but passing on ImageMagick 7.
The root cause appears to be that ImageMagick 6 has a bug where
`-colorspace RGB` corrupts grayscale pixel values during conversion.
In our test, grayscale value 85 becomes 23 when `-colorspace RGB` is
applied, even though the colorspace isn't actually changed (still
reports as Gray).
Testing showed:
- `convert input.jpg -auto-orient -scale 30x30!` -> pixel value 85
- `convert input.jpg -auto-orient -colorspace RGB -scale 30x30!` -> pixel value 23
- `convert input.jpg -auto-orient -colorspace sRGB -scale 30x30!` -> pixel value 85
According to [ImageMagick's porting guide](https://imagemagick.org/script/porting.php),
IM6 "does not have a true grayscale colorspace, and only fakes it with
linear RGB colorspace", which likely explains this behavior.
Since the test is about orientation handling, not colorspace conversion,
the fix appears to be (for ImageMagick) specifically: pass `colorspace='sRGB'`
instead in this specific test, which works correctly on both IM6 and IM7.
However, that might break tests for other backends. The alternative is to
change the `THUMBNAIL_COLORSPACE` setting for the ImageMagick tests only
and fix the resulting breakages from cache key changes.
I couldn't find an existing bug report for this to reference. I'm
guessing the answer is the same-ish for #781. I can provide a
`Dockerfile` to reproduce the behavior (even on a Mac OS host) if you'd
like.1 parent 7786fc9 commit c46636d
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
| |||
0 commit comments