View Full Version : Hex Code to Image

05-01-2009, 03:13 PM
Hi guys. Any ideas on how I can get this lookup to work..:?

I'm using a app that uploads an image and returns a hex code in a 3x3 grid. (See here: http://jrm.cc/color-palette-generator)

I want to take this one stage further and have a code that will then take the Hex code and look up a field in an sql database containing hex codes. Then convert the hex code into an image containing the selected colour. For example;

User uploads image of the sky
App returns hex codes of sky
App then needs to look in a field database of images on server and finds image/s with similar hex value
App then returns images in replace of the hex code (i.e blue water, swimming pool, blue coloured hat etc etc)

Any thoughts on how to acheive this?


Len Whistler
05-01-2009, 10:33 PM
Study the PHP image functions. imagecolorexact might be what you are looking for to get started. You would run all images through a loop and output the ones that match the uploaded image.