How to distinguish black and white photo using PHP

  1. Assume that we are uploading a photo and we want to tell if it's a color image or black and white.
    One way to find this out for JPEG and TIFF files is to use exif data of the photo.
  2. Let $file be the variable that contains the path to the image file on the server. Then the line $exif = exif_read_data($file); will create an array $exif where exif data is stored.
  3. If exists, array element $exif['COMPUTED']['IsColor'] contains data about the photo's color depth.
    $exif['COMPUTED']['IsColor'] == 1 - photo is a color image
    $exif['COMPUTED']['IsColor'] == 0 - photo is black and white
This service is a collection of tutorials and guides for different things
 
Why register? When you register you'll be able to write your own guides
Register
 
Dive into
 

 
Guide information
 
Author: shredder_y
Tags:
Rating:
3