色彩对比公式 ? (图像魔术师)

发布于 2025-01-11 20:56:17 字数 339 浏览 2 评论 0原文

我将图像减少到 12 种颜色,并用一些文本注释(这里是颜色饱和度,已排序):

在此处输入图像描述

文本颜色为%[pixel:p{10,10}*2](背景*2)(我制作了一个小脚本,如果您感兴趣,我可以分享)。

正如您所看到的,在所有情况下(颜色),文本的可读性(对比度)都不是很好。有没有比简单的线性缩放更智能的公式来使文本在所有/大多数情况下弹出?

I reduced an image to 12 colors, annotated with some text (here it's color saturation, sorted) :

enter image description here

The text color is %[pixel:p{10,10}*2] (background *2) (I made a little script that I can share if you're interested).

As you can see, text is not very readable (contrast) in all cases (colors). Is there a smarter formula than a simple linear scaling to make text pop in all/most cases ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

身边 2025-01-18 20:56:17

根据 Fred 的建议,使用亮度要好得多。使用黑色和白色文本取决于亮度> 56 或以上:

在此处输入图像描述

对于非彩色图像:

在此处输入图像描述

文本代表 HSL 值的 L 分量。请注意当值超过 56 时从黑色变为白色的变化。

As per Fred's suggestion, using luminosity is much better. Using black & white text depending on luminosity > 56 or not :

enter image description here

And for a not colorful image :

enter image description here

The text represents L component of HSL value. Notice the change from black to white when value crosses 56.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文