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; |
Beta Was this translation helpful? Give feedback.
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? |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
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.