Hello again!
I encountered a rather strange thing in processing 3.5.4 :
the code
def rgbshv(x,y):
col=[y>>16&0xFF,y>>8&0xFF,y&0xFF]
#print(col)
if x==0:
if max(col)==min(col):
return 0
if max(col)==col[0]:
print(col)
print((60*((col[1]-col[2])/(max(col)-min(col)))+360)%360)
return (60*((col[1]-col[2])/(max(col)-min(col)))+360)%360
if max(col)==col[1]:
return (60*((col[2]-col[0])/(max(col)-min(col)))+120)%360
if max(col)==col[2]:
return (60*((col[0]-col[1])/(max(col)-min(col)))+240)%360
if x!=0:
return max(col)
print(rgbshv(0,-1762268))
yields different results in processing than a python interpreter and an online color converter and gimp’s color mixer.
Here are screenshots : https://imgur.com/a/cGoYn6O
processing 4 doesn’t run on my computer so i couldn’t try it in it.
The hue command also gives different results from the online converter and interpreter and gimp and this time also the code in processing.
I tried print(hue(color(229,28,36)))
and i got 253.308456421
, which is also quite different form the online converter’s 358.
Gimp’s color mixer gives me the same results as the online converter and the python interpreter,so the issue should reside in processing. Am i missing something?
How could i get the correct hue of the colors?
Thanks in advance.