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

8
LINES

< > BotCompany Repo | #1020181 // saturationFromRGB

JavaX fragment (include)

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

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: 337 / 370
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1020182 - averageSaturation
#1024728 - alternativeSaturationFromRGB_1 - lower saturation for very bright and dark colors