Libraryless. Click here for Pure Java version (3846L/22K).
1 | // allegedly the best method for rgb to grayscale conversion: |
2 | // Z=0.2126×R+0.7152G+0.0722B |
3 | |
4 | static int rgbToLuminosity(int rgb) { |
5 | int r = (rgb >> 16) & 0xFF; |
6 | int g = (rgb >> 8) & 0xFF; |
7 | int b = rgb & 0xFF; |
8 | ret iround(r*0.2126+g*0.7152+b*0.0722); |
9 | } |
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033305 |
Snippet name: | rgbToLuminosity |
Eternal ID of this version: | #1033305/2 |
Text MD5: | f15d78746eca744e444dc9e00aea548f |
Transpilation MD5: | 24aaa965e17f696c8d499e91b070a4fe |
Author: | stefan |
Category: | javax / maths |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-10-21 01:14:25 |
Source code size: | 266 bytes / 9 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 152 / 223 |
Version history: | 1 change(s) |
Referenced in: | [show references] |