从十六进制颜色代码转换颜色名称 [英] Convert in Color Name from Hex Color Code

查看:112
本文介绍了从十六进制颜色代码转换颜色名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从图片中拿出一点,想知道那个位的颜色



有谁可以告诉我我要写的代码是什么拿起该位并将其值设置为字符串(即颜色名称)以及24位RGB中该颜色的二进制值。

I want to pick up a bit from picture and wants to know the color of that bit

can anybody tell me what code i have to write for that to pick up the bit and to have its value in string(i.e. name of color) and also the binary value for that color in 24-bit RGB.

推荐答案

所有,请阅读我对这个问题的评论。



看看这里:

http://stackoverflow.com/questions/2109756/how-to-get-color-from-十六进制颜色代码使用网络[ ^ ]

http://stackoverflow.com/questions/5014091/using-hexadecimal-color-code-in-syste m-drawing-color [ ^ ]

http://www.cambiaresearch.com/articles/25/convert-hex-string-to-dotnet-color [ ^ ]

http://social.msdn.microsoft.com/论坛/ vstudio / zh-CN / f680c6c6-5c77-4bd2-af2a-0696338f1a98 / how-to-the-colors-hex-string [ ^ ]



其他有趣的资源:

Bitmap.GetPixel方法 [ ^ ]

使用C#在图像中检测颜色 [ ^ ]

ColorFinder - 检索桌面上任何像素的颜色 [ ^ ]



启动是否足够?
First of all, please, read my comment to the question.

Have a look here:
http://stackoverflow.com/questions/2109756/how-to-get-color-from-hexadecimal-color-code-using-net[^]
http://stackoverflow.com/questions/5014091/using-hexadecimal-color-code-in-system-drawing-color[^]
http://www.cambiaresearch.com/articles/25/convert-hex-string-to-dotnet-color[^]
http://social.msdn.microsoft.com/Forums/vstudio/en-US/f680c6c6-5c77-4bd2-af2a-0696338f1a98/how-to-get-the-colors-hex-string[^]

Other interesting resources:
Bitmap.GetPixel Method[^]
Color Detecting in an Image in C#[^]
ColorFinder - Retrieve the color of any pixel on the Desktop[^]

Is it enough for start?


既然你自己似乎没有做过任何事,我就不会给你代码了/>


首先,将您的图片读入Bitmap Class实例。

然后,使用Bitmap.GetPixel读取您想要的像素 - 这将返回一个Color实例。

Color类具有Name属性,如果它向后工作,它就是你想要的。但它没有,并且并非所有Color值都有名称 - 可以理解,至少有1600万个......

你可以这样做(对于有名字的颜色)和这个解释如何: http://stackoverflow.com/questions/10875874/c-sharp-color -name-from-argb [ ^ ]



如果您有Color值,您可以从中获取二进制RGB值。
Since you don't appear to have done anything yourself, I won't give you the code.

First, read your picture into a Bitmap Class instance.
Then, read the pixel you want using Bitmap.GetPixel - this returns a Color instance.
The Color class has Name property, which would be exactly what you want if it worked backwards. But it doesn't, and not all Color values have names - understandable, there are at least 16 million of them...
You can do it though (for the colors that have names) and this explains how: http://stackoverflow.com/questions/10875874/c-sharp-color-name-from-argb[^]

If you have the Colour value you can get the binary RGB values from that.


这篇关于从十六进制颜色代码转换颜色名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆