Skip to main content
scotwllm
Inspiring
November 6, 2023
Answered

Photoshop's RGB to HSB calculation

  • November 6, 2023
  • 2 replies
  • 488 views

When I type RGB values or a hex code into Photoshop's color picker, it automatically calculates HSB values. What are the formulas used to calculate the H, S, and B values presented in the color picker tool?

 

Scott

This topic has been closed for replies.
Correct answer scotwllm

H = IF(180/PI()*ATAN2(2*R-G-B,SQRT(3)*(G-B))<0,180/PI()*ATAN2(2*R-G-B,SQRT(3)*(G-B))+360,180/PI()*ATAN2(2*R-G-B,SQRT(3)*(G-B)))

S=(Max(R,G,B)-Min(R,G,B))/Max(R,G,B)

B=Max(R,G,B)/255

 

2 replies

scotwllm
scotwllmAuthorCorrect answer
Inspiring
July 30, 2024

H = IF(180/PI()*ATAN2(2*R-G-B,SQRT(3)*(G-B))<0,180/PI()*ATAN2(2*R-G-B,SQRT(3)*(G-B))+360,180/PI()*ATAN2(2*R-G-B,SQRT(3)*(G-B)))

S=(Max(R,G,B)-Min(R,G,B))/Max(R,G,B)

B=Max(R,G,B)/255

 

Kevin Stohlmeyer
Community Expert
Community Expert
November 7, 2023