Last active
October 23, 2015 12:34
-
-
Save OutOfBrain/cff683a5a98ee251f291 to your computer and use it in GitHub Desktop.
Remove images if they contain mostly black
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $filename = $argv[1]; | |
| $dark = explode('/', `identify -format "%[EXIF:BrightnessValue]" $filename`)[0]; | |
| if ($dark < 100) { | |
| echo 'remove ' . $filename . PHP_EOL; | |
| unlink($filename); | |
| } | |
| echo '.'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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