Skip to content

Fix RGB to sRGB conversion formulas in Command-line Options page - #155

Open
michaelbnewman wants to merge 1 commit into
ImageMagick:mainfrom
michaelbnewman:fix-rgb-to-srgb
Open

Fix RGB to sRGB conversion formulas in Command-line Options page#155
michaelbnewman wants to merge 1 commit into
ImageMagick:mainfrom
michaelbnewman:fix-rgb-to-srgb

Conversation

@michaelbnewman

Copy link
Copy Markdown
Contributor

In the process of fixing typos in the Command-line Options page, I found the formulas for converting RGB to sRGB need additional corrections:

  • Remove extra decimal dot in front of .0.0031308 to 0.0031308
  • Correct rounding of 0.0031308 to 0.0031307 to match source code
  • Corrected usage of R, G, and B variables (each channel should have matching Rs/R Gs/G, Bs/B variables)
  • Based on source code, corrected 12.92 from division to multiplication

Source code involved:
https://github.com/ImageMagick/ImageMagick/blob/main/MagickCore/pixel.c#L445-L451

The source code includes usage of QuantumRange and QuantumScale, but those cancel out properly to match the documentation here as written.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant