My security cam has a failure, sometimes at the movement, the first snaps are black. That’s not a really a problem but I was looking for a way to delete those black images via a PHP script.

This one works great with a fully black images:

```
<?php
function check_if_black($src){

   $img = imagecreatefromjpeg($src);
    list($width_orig, $height_orig)=getimagesize($src);
    for($i=0;$i<20;$i++){
        $rand_width=rand ( 0 , $width_orig );
        $rand_height=rand ( 0 , $height_orig );
        $rgb = imagecolorat($img, $rand_width, $rand_height);
        if($rgb!=0){
            return "not black";
        }
    }
    return "black";
}
?>

```

My snaps have a white timestamp on it. Always in the same position and always with white text. With the code I posted above it says the image isn't black. But `80%` of it is. Is there a way to detect if the snapshot is black and ignores the white timestamp on it? 

A sample of a snapshot:
[![Sample screenshot](https://i.stack.imgur.com/UAnLh.jpg)](https://i.stack.imgur.com/UAnLh.jpg)