Repository navigation
How to get per channel luminance data? #1309
|
Is there an easy way to get per channel luminance (brightness) data in ImageSharp? In Magick.net I'd do something like: Statistics stats = image.Statistics();
double red = stats.GetChannel(PixelChannel.Red).Mean; |
Answered by
JimBobSquarePants
Aug 8, 2020
Replies: 2 comments 5 replies
|
On a completely different subject, how do I get github discussions to not ignore the newline between those two lines of code in my example? |
2 replies
|
That example you've cited from Magick.NET isn't luminance by my reckoning, merely an average of the red component. Luminance is the weighted sum of linear RGB components. See #1287 for an example of determining the Luma (weighted sum of gamma compressed RGB components). This is the most common supposition of brightness. |
3 replies
Answer selected by
JimBobSquarePants
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That example you've cited from Magick.NET isn't luminance by my reckoning, merely an average of the red component.
Luminance is the weighted sum of linear RGB components.
See #1287 for an example of determining the Luma (weighted sum of gamma compressed RGB components). This is the most common supposition of brightness.