Skip to content

Instantly share code, notes, and snippets.

@OutOfBrain
Last active October 23, 2015 12:34
Show Gist options
  • Select an option

  • Save OutOfBrain/cff683a5a98ee251f291 to your computer and use it in GitHub Desktop.

Select an option

Save OutOfBrain/cff683a5a98ee251f291 to your computer and use it in GitHub Desktop.
Remove images if they contain mostly black
<?php
$filename = $argv[1];
$dark = explode('/', `identify -format "%[EXIF:BrightnessValue]" $filename`)[0];
if ($dark < 100) {
echo 'remove ' . $filename . PHP_EOL;
unlink($filename);
}
echo '.';
parallel -j8 'php removeifdark.php {}' ::: *.jpg
# ls | xargs -P 8 -L 1 php removeifdark.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment