Jump to content

Incorrect labeling HSV values in colour picker tools. (Rounding Error)


Go to solution Solved by BoltBait,

Recommended Posts

Sometimes, the colour picker will incorrectly label the V value of a colour. Here's an example:

1. If you choose an HSV of 0/0/50 (medium grey), you will end up with an RGB of 127/127/127. 255/127=49.8%. Correct.

2. If you choose an HSV of 0/0/49 (marginally darker medium grey), you will end up with an RGB of 124/124/124. 255/124=48.63%. Correct.

3. If you choose an RGB of 127/127/127, you will end up with an HSV of 0/0/49. This also occurs if you start as in example 1. and switch between your 2 colours. My guess is that this is due to a rounding error, because, as I mentioned, 255/127=49.8%, so it rounds downwards.

This bug isn't a huge issue because the RGB value doesnt change, but it can be confusing and annoying. An easy solution would be to change HSV to be from 0-255 instead of 0-100, or an option to view it as such.

Link to comment
Share on other sites

  • Solution

There is not an exact translation between RGB and HSV.  Rick provides both as a convenance, but just understand that it isn't an exact translation.

 

Much work has been done in this area to get the numbers as consistent and accurate as possible.  But, sometimes it just isn't possible.

Click to play:
j.pngs.pngd.pnga.pngp.png
Download: BoltBait's Plugin Pack | CodeLab | and how about a Computer Dominos Game

Link to comment
Share on other sites

27 minutes ago, BoltBait said:

There is not an exact translation between RGB and HSV.  Rick provides both as a convenance, but just understand that it isn't an exact translation.

 

Much work has been done in this area to get the numbers as consistent and accurate as possible.  But, sometimes it just isn't possible.

Ah, I see. A little unfortunate. An option to turn on 0-255 would be ideal but it's not a major issue, it's just a strange quirk that I observed.

Link to comment
Share on other sites

11 hours ago, CDriv3 said:

Ah, I see. A little unfortunate. An option to turn on 0-255 would be ideal but it's not a major issue, it's just a strange quirk that I observed.

There is a way to get 0-255 HSV, but I don't think it's ideal for you and it's probably never going to be implemented.

 

Copy the layer that you want to pick color from. Set the layer opacity to 0. Do not click on any other layer, just proceed with looking at plugins. Go to G'MIC-QT plugin, and go to Various-> Code (Any). Replace the textbox with rgb2hsv8. Press Ok.

 

This will allow you to get colors in HSV 0-255 form.

 

Alternatively, a plugin to speed up this step is desirable actually. I don't think it's too hard to do anyway.

 

If you can figure out what's wrong with this:

 

You can get a solution that doesn't involve this workaround.

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...