New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Negative color space coordinates after resize #6821
Comments
If your IM has HDRI, many operations can result in negative pixel values (or values larger than 100%). For example, " You can use " |
I agree that for HDR imaging it certainly makes sense to leave the color coordinates unbounded from the top. However, in terms of negative coefficients, the story is different. It may not be desired that you leave the color space that is spanned by the primaries. But if you enforce clamping to stay in your color space, my understanding is that you also clamp to the upper bound of the color space range, which is not what you want for (floating point) HDR. |
Yes, |
And what if I just want to assert that the XYZ or LMS coordinates are non-negative and otherwise tolerate values escaping the spanned color space? (Honestly, I think that should be the default. Things like negative luminance make no sense in any scenario.) |
IM is a fairly low-level system. It does what we tell it to, whether the colorspace is sRGB or XYZ or whatever. If you want different processing according to the colorspace, you need to build that into your scripts or programs. |
ImageMagick version
7.1.1-21
Operating system
MacOS
Operating system, version and so on
13.6 Darwin Kernel Version 22.6.0
Description
An operation like
magick input.exr -resize 50% output.exr
results in negative color coordinates in the output, likely caused by a band limiting convolution kernel with negative coefficients. The problem is probably present in other sorts of combinations of band limiting and floating point image formats.Applications having to deal with negative color coordinates might not be prepared for it and may even crash or at least produce undesirable output.
Bounding the color space coordinates by zero from below would solve the problem and is the generally accepted way to handle the issue in image processing.
Steps to Reproduce
Take any floating point encoded image like openEXR with enough contrast and resize it to a smaller size. Inspect the output.
Images
No response
The text was updated successfully, but these errors were encountered: