Is there an easy way to convert between color models in Java (RGB, HSV and Lab).
Assuming RGB color model:
- How do I calculate black body spectrum color palette? I want to use it for a heatmap chart.
- How about single-wavelength spectrum?
Edit: I found that the ColorSpace class can be used for conversions between RGB/CIE and many other color models.
You can build such a palette using the HSV color-model. That’s easy once you have the HSV to RGB code in place and play around with the numbers for some minutes.
However, I think it’s not worth it to add the code to your project just to generate a little palette.
It’s much easier and less work to extract the palettes you need from a file and add them as a static array.
Photoshop let’s you edit palettes and comes with a very nice black body palette as a preset.
You can simply save these as a .act file. The file itself is just a simple 256 color á 3 byte file (order is read, green, blue. 8 bits per channel).