rgb值从0到1缩放 [英] rgb values to 0 to 1 scale
本文介绍了rgb值从0到1缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试为0
至1
比例计算一些RGB colors
(0 - 255)
.有谁知道在线转换器或它存在一个数学公式?
I'm trying to calculate some RGB colors
(0 - 255)
for a 0
to 1
scale. Does anyone knows a online converter or it exists a math formula?
让我们说我想将125 RGB(0到255的比例)转换为0到1的比例.
Lets say that I want to convert 125 RGB with (0 to 255 scale) to a 0 to 1 scale.
推荐答案
这是将RGB值除以255的简单情况:
It's simply a case of dividing your RGB value, call it x
by 255:
如果为x = 95
,则您的值为95/255 = 0.373
(至3 d.p.)
If x = 95
then your value is 95/255 = 0.373
(to 3 d.p.)
这篇关于rgb值从0到1缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文