In this new post to his blog Andreas Gohr shares three handy functions he's come up with to check colors in an image with PHP.

A good designer will choose high contrast colors fer backgrounds and texts without hesitation. But sometimes no human is involved in choosin' th' colors. For example when colors are assigned in a (pseudo) random manner. [...] After some googlin' I found a page explainin' different color contrast algorithms. Load the cannons! I used th' data from that page and implemented 3 color check functions in PHP.

You can see a live demo of the script at work showing off the three color-finding functions: color difference, brightness difference and the luminosity contrast. There's also a method for calculating the Pythagorean distance between the colors included now too.

DevShed concludes their series on using the GD graphics libraries in PHP with thie new article focusing on the use of some of the simple filtering functionality the library has to offer.

In this article I'm going to demonstrate how the GD library can be used to apply some basic graphic filters (yes, like Photoshop, but much simpler) by utilizing the versatility of a brand new function called "imagefilter()". As you'll see shortly, with this function it is possible to reverse, blur and highlight the colors of a determined image, as well as convert it to its grayscale version, among other things.

They use the imagefilter function in a few different examples - altering the colors in an image, working with contrast and brightness and various other filters (like smoothing, embossing, blurring and colorizing).