Skip to content
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

Conversion from/to Adobe98, DisplayP3 or ProPhoto yields incorrect results #7038

Closed
0f-0b opened this issue Jan 17, 2024 · 2 comments
Closed

Comments

@0f-0b
Copy link

0f-0b commented Jan 17, 2024

ImageMagick version

7.1.1-26

Operating system

MacOS

Operating system, version and so on

macOS 14.1.1

Description

Converting an sRGB image to Adobe98, DisplayP3 or ProPhoto using -colorspace results in pixel values multiplied by QuantumRange, and converting an Adobe98, DisplayP3 or ProPhoto image to sRGB divides the input values by QuantumRange.

Steps to Reproduce

With the Q16 HDRI build from Homebrew:

$ magick -depth 8 canvas:'srgb(100%,0%,0%)' -colorspace display-p3 txt:-
# ImageMagick pixel enumeration: 1,1,0,255,displayp3
0,0: (15333601,3347367,2315759)  #FFFFFF  displayp3(6.01318e 06%,1.31269e 06%,908141%)

$ magick -depth 8 canvas:'display-p3(100%,0%,0%)' -colorspace srgb txt:-
# ImageMagick pixel enumeration: 1,1,0,255,srgb
0,0: (0,0,0)  #000000  srgb(0.00186884%,-6.41763e-05%,-2.99722e-05%)

$ # These are the correct results
$ magick -depth 8 canvas:'srgb(100%,0%,0%)' -colorspace display-p3 -evaluate divide 65535 txt:-
# ImageMagick pixel enumeration: 1,1,0,255,displayp3
0,0: (234,51,35)  #EA3323  displayp3(91.7552%,20.0304%,13.8573%)

$ magick -depth 8 canvas:'display-p3(100%,0%,0%)' -evaluate multiply 65535 -colorspace srgb txt:-
# ImageMagick pixel enumeration: 1,1,0,255,srgb
0,0: (279,0,0)  #FF0000  srgb(109.299%,-54.3388%,-25.3778%)

With a Q32 HDRI build:

$ magick -depth 8 canvas:'srgb(100%,0%,0%)' -colorspace display-p3 txt:-
# ImageMagick pixel enumeration: 1,1,0,255,displayp3
0,0: (1004918212358,219376405103,151767922687)  #FFFFFF  displayp3(3.9408558e 11%,8.6029965e 10%,5.9516832e 10%)

$ magick -depth 8 canvas:'display-p3(100%,0%,0%)' -colorspace srgb txt:-
# ImageMagick pixel enumeration: 1,1,0,255,srgb
0,0: (0,0,0)  #000000  srgb(2.8515823e-08%,-9.7923726e-10%,-4.5733248e-10%)

$ magick -depth 8 canvas:'srgb(100%,0%,0%)' -colorspace display-p3 -evaluate divide 4294967295 txt:-
# ImageMagick pixel enumeration: 1,1,0,255,displayp3
0,0: (234,51,35)  #EA3323  displayp3(91.755199%,20.030412%,13.857342%)

$ magick -depth 8 canvas:'display-p3(100%,0%,0%)' -evaluate multiply 4294967295 -colorspace srgb txt:-
# ImageMagick pixel enumeration: 1,1,0,255,srgb
0,0: (279,0,0)  #FF0000  srgb(109.29903%,-54.338837%,-25.377825%)

Images

No response

@urban-warrior
Copy link
Member

Thank you for reporting the issue. We have successfully reproduced it and are actively working on a patch to resolve it. You can expect this patch to be merged into the main GIT branch, later today. As part of our commitment to quality, this fix will also be included in the upcoming beta releases of ImageMagick by tomorrow. Your patience and feedback are greatly appreciated.

@0f-0b
Copy link
Author

0f-0b commented Jan 23, 2024

Confirming that this is fixed in 7.1.1-27. Thanks!

@0f-0b 0f-0b closed this as completed Jan 23, 2024
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jan 28, 2024
7.1.1-27 - 2024-01-21

Merged

    fix PKG_CONFIG_LIBDIR #7013

Commits

    beta release 3042ca2
    Use constImage instead. b449e0f
    export an exception when functions do not include an enclosing parenthesis (ImageMagick/ImageMagick#4533) ea0ea9c
    check maximum number of meta channels c099a19
    fix compiler exception f76166c
    deprecate InitializePixelCacheMap() and introduce ResetPixelCacheMap() 35ba540
    prevent possible integer overflow 7ae3b4b
    cosmetic 1db97cd
    fix compiler exception c02ab48
    eliminate compiler warning eaa6f6c
    move check for excessive meta channels 2133d30
    Corrected setting the quantum_type for the red channel that caused issues with multi spectral images. 906758c
    fix scaling of {display-p3,pro-photo,adobe-98} colorspace (ImageMagick/ImageMagick#7038) 35e6851
    adjust copyright year bc88c69
    Corrected patch to fix reading multi spectral images. 9c64c66
    release 0225ac4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants