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

8
LINES

< > BotCompany Repo | #1024728 // alternativeSaturationFromRGB_1 - lower saturation for very bright and dark colors

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (137L/1K).

static float alternativeSaturationFromRGB_1(int rgb) {
  int r = (rgb >> 16) & 0xFF;
  int g = (rgb >> 8) & 0xFF;
  int b = rgb & 0xFF;
  double brightness = (r+g+b)/255.0;
  double factor = abs(brightness-0.5)*2;
  ret (float) (saturationFromRGB(rgb)*factor);
}

Author comment

Began life as a copy of #1020181

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024728
Snippet name: alternativeSaturationFromRGB_1 - lower saturation for very bright and dark colors
Eternal ID of this version: #1024728/2
Text MD5: 0d338195dc3ab39ea644af8cadb274ea
Transpilation MD5: fcc3357c242958b627d8f65c33be51dc
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-24 14:51:50
Source code size: 269 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 228 / 310
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)