# Scaling HSB colors for export

In Mathematica, Hue[h,s,b] uses HSB colors. However, unlike anything I've ever seen, the h, s, and b have to be between 0 and 1. The trouble is that I am trying to use Mathematica to take NSB colors out of an image and pass them to another program, so I need my h to be between 0 and 360 (Which is believe is the standard way) and s and b to be between 0 and 100.

How can I convert Mathematica's HSB to what I described?

• Just multiply the MMA values by 360/100/100 to go out, or divide by same to go in, or am I missing something?
– ciao
May 22, 2016 at 0:07

You can write your own converter like so:

hue2HSB[color : Hue[h_, s_, b_]] := {360. h, 100. s, 100. b}


then

Hue[0.55, 0.73, 0.82]


The next step would be to export the conversion, but since you don't indicate how you plan to do that, I can't say anything more.

• Thank you! To expand on this, I have a list of lists of colors. How would I apply this function to each of the colors without loops? May 22, 2016 at 0:45
• @user40421. Look up Map; it is the usual function for applying a function to a list of values. May 22, 2016 at 0:56