Hi everyone,
This is my first time posting here, it looks like a great site so I hope someone can assist with my problem. I'm currently attempting to write a PHP script that can examine each pixel in an image one by one and check whether it is the same as a specified colour (RGB value). The problem is there seem to be slight variations in the colours. The pixels that I want to identify are seemingly a number of different shades of the same colour, the differences are so minute that it is not noticeable when viewing the image but it causes problems for the software. What I want to achieve is to have a script that can take an RGB value and check if the pixels are roughly the same as the specified colour. I hope I have outlined my predicament clearly enough. Sorry for not having any code but at the moment I don't have anything of much value.
Thanks in advance.
Checking if a pixel is close to a specified colour with GD
Moderator: General Moderators
-
Right Wing Liberal
- Forum Newbie
- Posts: 3
- Joined: Sat Dec 27, 2008 11:04 am
Re: Checking if a pixel is close to a specified colour with GD
Well, I have never used GD but if you want to see if a pixel matches a range of colours, you would have to specify the range for each colour value and check to see if all of the colour values fall within your specified range.
RGB...112233 to 223333
Check to see if R is between 11 and 22, G is between 22 and 33, and if B is 33. If it is, then it is within your range and everything is good. Maybe GD offers a better way but as stated above, I have never used GD. Good luck.
RGB...112233 to 223333
Check to see if R is between 11 and 22, G is between 22 and 33, and if B is 33. If it is, then it is within your range and everything is good. Maybe GD offers a better way but as stated above, I have never used GD. Good luck.
-
Right Wing Liberal
- Forum Newbie
- Posts: 3
- Joined: Sat Dec 27, 2008 11:04 am
Re: Checking if a pixel is close to a specified colour with GD
Thanks Watson, I'll give that a shot and see how it goes