How can I detect how many colors an image has, adn then return the RGB or Hex values of those colors in PHP? With the standard file formats… PNG, JPG, GIF etc.
Sample image:

Used for:
An online design tool which allows you to upload images for use in the designer. I’m trying to reject all images with over 10 colors (or potentially reduce the colors?). For images with less then 10 colors, I’m trying to return the Hex or RGB values of each color that is present (the more colors present, the more expensive the printing process).
1 Answer