Hogie Posted July 15, 2014 Share Posted July 15, 2014 I am trying to find a certain like color distance or measurement from one color to the next, like Under Hue / Saturation. How do I find the numbers from this first color to this second color Hue: 0 -----> Hue: ? Sat: 100 -----> Sat: ? Lightness: 0 -----> Lightness: ? Other than physically finding it, which I can't seem to, is there a way to just get these such as a finder or something like that of which I am missing? Sorry if this is very vague, I am just very confused right now haha Quote Link to comment Share on other sites More sharing options...
BoltBait Posted July 15, 2014 Share Posted July 15, 2014 Paint.NET doesn't use the HSL color space (Hue/Saturation/Lightness), it uses HSV (Hue/Saturation/Value) instead. Are you trying to do this once? Or lots of times programatically? Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
Hogie Posted July 15, 2014 Author Share Posted July 15, 2014 Several times but with different colors Quote Link to comment Share on other sites More sharing options...
BoltBait Posted July 15, 2014 Share Posted July 15, 2014 OK, your best bet then is to just use the Color Picker Tool and press the More>> button in the :Colors: Color Docker window. There, you can see the various values of the current color. If you were writing a program to do the comparison, you'd usually calculate the difference in colors to determine which color of a palette is the nearest color to the one you're working on. In this scenario, you'd usually calculate the Red, Green, and Blue difference and square it (this makes all values positive--no need to then take the square root). Color FindNearestColor(Color color, Color[] palette) { int minDistanceSquared = 255 * 255 + 255 * 255 + 255 * 255 + 1; byte bestIndex = 0; for (byte i = 0; i < palette.Length; i++) { int Rdiff = color.R - palette[i].R; int Gdiff = color.G - palette[i].G; int Bdiff = color.B - palette[i].B; int distanceSquared = Rdiff * Rdiff + Gdiff * Gdiff + Bdiff * Bdiff; if (distanceSquared < minDistanceSquared) { minDistanceSquared = distanceSquared; bestIndex = i; } } return palette[bestIndex]; } Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
Hogie Posted July 15, 2014 Author Share Posted July 15, 2014 Ok, thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.