Jump to content

Is this even possible ? (to detect if uploaded image is B&W or color)


2levelsabove

Recommended Posts

Since images don't have a specific heading or flag accessible within PHP as to whether or not they are color or B/W, you could quickly scan the image pixel by pixel and gather all the colors used within the image. You would then be able to parse the list and see if anything besides gray scale was used... Check the imagecolorat() function to see how to read the individual pixel colors.

 

Hope this helps point you to a viable solution.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.