Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

8
LINES

< > BotCompany Repo | #1020181 // saturationFromRGB

JavaX fragment (include)

1  
static double saturationFromRGB(int rgb) {
2  
  int r = (rgb >> 16) & 0xFF;
3  
  int g = (rgb >> 8) & 0xFF;
4  
  int b = rgb & 0xFF;
5  
  int min = min(min(r, g), b);
6  
  int max = max(max(r, g), b);
7  
  ret max != 0 ? (max-min) / (double) max : 0;
8  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020181
Snippet name: saturationFromRGB
Eternal ID of this version: #1020181/2
Text MD5: ebc10f123c8f3a00cfc3594514d4047d
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-09 21:07:10
Source code size: 241 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 336 / 370
Version history: 1 change(s)
Referenced in: [show references]