How do I find color in image?

Hi there guys,
I am working on a color picker for my app,
Especially is my current problem to position the marker to the coresponding color when a user provides a hexcode or RGBA colors.
Is there any extension for this?

If it doesn't, it's allright.

Thanks in advance for your time!

If using the canvas, you would need to iterate over each pixel, get the colour for that pixel, and compare it with the supplied colour. If there is a match, then place the marker on that pixel location. This might take some considerable time with a high resolution image.

1 Like
1 Like

Ok, nvm. Thanks for your help @TIMAI2, @SteveJG!

But I got one last question: How does it work in microsoft paint? I mean if it would loop through the pixels it would take way longer than it does.

Its the default paint program for Windows. :wink:

What is paint, a program ? If so, it probably uses a different method.

1 Like

Well @TIMAI2, I foznd an extension to covert RGB to HSV ([FREE] Color Converter) and as I found out it's possible to do what I want (with a color wheel).
Once I got the blocka set up i'll send a screenshot of how I did it.

@TIMAI2

Um I found on stackoverflow how to do what I am trying.

But it doesn't set the marker to the right position.

The .aia file (348.1 KB)

1 Like

Are you adjusting your x/y with the centre of the colour wheel , remembering that the canvas top left = 0/0

You should also bear in mind, that with a canvas of 200x200 for your colour wheel, the maximum numbers of colours it can return is 40,000. In reality this will be much less, say @ 3000. This is a far reach from the possible 16.7 million colours you can generate from an RGB value. You will only get a max of 0.24% of colours addressable by RGB. Think on :slight_smile:

2 Likes

Hi thanks for the explanation.

But do you know how I could calculate it so it might work?

Um, I think for underglow (thats what I wanna control with that app) of a vehicle I don't really need all 16.7 million colors. If I remember right I got about 60 LED per meter (3,3 feet)

The thing is, a user can type in the RGB values, the colour can then be displayed, as you are doing, in an arrangement as a background colour, but the colour may not exist on the colour wheel, so it cannot be identified by a marker.

There might be a way to identify a similar colour, that is on the colour wheel, with the one entered, and place the marker there, using a predefined table of some kind, but this could be overly complex?

1 Like

Ok, thanks. Ya I didn't really think about that fact. It would have been very cool but if it is as complicated as mentioned I don't need it. As it is a private app.

But still thanks a lot for your time

You might be able to do what you want with html/javascript see HERE

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.