Java RGB to HSB Conversion: An Introduction

  • Thread starter Thread starter internet user
  • Start date Start date
  • Tags Tags
    Introduction
Click For Summary
The discussion centers on the differences between RGB and HSB color models and the process of converting between them, particularly in Java programming. RGB (Red, Green, Blue) is an additive color model, while HSB (Hue, Saturation, Brightness) represents colors in a way that aligns more closely with human perception. A key point raised is that conversions between RGB and HSB cannot be exact due to the nature of the models; for instance, when saturation (S) is zero in HSB, the hue (H) becomes irrelevant, as all shades of grey are represented by the same value. This indicates that there are more RGB values than HSB values for any given bit depth, complicating the conversion process. A Java code example for conversion is referenced, highlighting practical implementation.
internet user
Messages
1
Reaction score
0
I came across HSB for the first time when I was reading a guide on Java. What is the difference between the two, and how do you convert from RGB to HSB (and vice versa)?
 
Technology news on Phys.org
Q: How do I do this thing?
A: Like this: public class DoThisThing extends Applet{

Hmmm...

It occurs to me that such conversions can't be exact. in HSB, if S=0, then H becomes irrelevant. No matter what value is in H, the exact same shade of grey is defined. Because there is no RGB equivalent to this, there are more RGB values then HSB values for any given bit depth.
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 8 ·
Replies
8
Views
2K
Replies
86
Views
1K
  • · Replies 14 ·
Replies
14
Views
5K
Replies
1
Views
2K
  • · Replies 0 ·
Replies
0
Views
1K
Replies
8
Views
2K
Replies
4
Views
2K
Replies
6
Views
4K
Replies
7
Views
2K