0

I am trying to convert back and forth between HSB color and Lab color in Processing / Java. I know that I can first convert HSB to RGB then to Lab, is it possible to directly convert from HSB to Lab? If so, how to do that?

Thanks a lot!

John Stone
  • 43
  • 7

1 Answers1

1

Unfortunately I can't provide a detailed answer.

There are fomulas of course: HSB, CIE XYZ as you'll need for sRGB to CIE XYZ to then convert CIE XYZ to Lab*. I'm sure you find implementations out

In terms of Java/Processing perhaps there is something already out there. FWIW you can check out this older example of mine using OpenFrameworks.

search images by dominant colour demo

OpenFrameworks is to c++ as what Processing is to Java. Hopefully you'll have no trouble swapping struct for class and #define for float, etc. The syntax is not that different in this case.

George Profenza
  • 45,059
  • 16
  • 133
  • 201
  • I tried to rewrite your code in Java, but was not able to obtain the same RGB value after converting from RGB to Lab then back to RGB, is there anything wrong in my rewriting? https://stackoverflow.com/a/62916036/1044679 – John Stone Jul 15 '20 at 13:29