CSS 色调旋转使图像变暗
CSS Hue Rotate is Darkening Image
我注意到 CSS 中的 hue-rotate
滤镜使我的图像变暗。
见https://jsfiddle.net/m4xy3zrn/
请注意,使用滤镜的第二张图片明显比在 photoshop 中旋转的第三张图片暗。
有什么办法可以避免这种情况吗?
再看看,这里发生了很多奇怪的事情。黄色似乎几乎都消失了,彩虹色调(右上角)中蓝色区域的饱和度大大降低。
Photoshop 使用 HSB 颜色模型,但 CSS 使用 HSL。
- HSB 亮度 在 100% 时从黑色 (0%) 变为全彩色
- 在 HSL 中 亮度 在 50% 时从黑色 (0%) 变为全彩色,到
白色为 100%
所以我想他们都是对的,如果有道理的话!
The hue-rotate filter does not do a true hue rotation. It does an approximation of hue-rotate in the RGB space - which clips highly saturated colors (like primaries) very badly. (Under the covers, it's using this approximation)。没有办法避免这种情况 - 当您关心颜色准确性时,请不要使用 hue-rotate。
(由于其不准确,我认为 hue-rotate 过滤器应该被修复,或者从规范中删除。)
我注意到 CSS 中的 hue-rotate
滤镜使我的图像变暗。
见https://jsfiddle.net/m4xy3zrn/
请注意,使用滤镜的第二张图片明显比在 photoshop 中旋转的第三张图片暗。
有什么办法可以避免这种情况吗?
再看看,这里发生了很多奇怪的事情。黄色似乎几乎都消失了,彩虹色调(右上角)中蓝色区域的饱和度大大降低。
Photoshop 使用 HSB 颜色模型,但 CSS 使用 HSL。
- HSB 亮度 在 100% 时从黑色 (0%) 变为全彩色
- 在 HSL 中 亮度 在 50% 时从黑色 (0%) 变为全彩色,到 白色为 100%
所以我想他们都是对的,如果有道理的话!
The hue-rotate filter does not do a true hue rotation. It does an approximation of hue-rotate in the RGB space - which clips highly saturated colors (like primaries) very badly. (Under the covers, it's using this approximation)。没有办法避免这种情况 - 当您关心颜色准确性时,请不要使用 hue-rotate。
(由于其不准确,我认为 hue-rotate 过滤器应该被修复,或者从规范中删除。)