PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Anyone have any idea how to start a function which selects the dominant colour in a 50x50 square? I can store all RGB values into an array using a foreach() and this...
you could resample the image to 1x1 and test the resulting pixel color for the "mean" or average colour.
The mode would be trickier, but doable. I'd start by converting to an indexed format, thereby letting the image algorithm do the heavy lifting for you. Then you can simply tabulate the number of pixels that map to each colour and sort to find the most common.