PHP class to detect density of colors in an image (JPEG, GIF, PNG)