I have a function for trimming white areas around images that works something like
if(imagecolorat($img, $x, $top) != 0xFFFFFF) {
//sets where the top part of the image is trimmed
}
The problem is some images have an occasional stray pixel that is so near white that it's unnoticeable but screws up the cropping because it's not exactly 0xFFFFFF but 0xFFFEFF or something. How could I rewrite the above statement so that it evaluates true for those near white images, say down to 0xFDFDFD, obviously without testing for ever possible value.