Created
February 3, 2020 21:28
-
-
Save victoriadrake/838e1f7494a9d205c2bfaf2304bed534 to your computer and use it in GitHub Desktop.
This file contains 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
# Look in the public/ directory | |
find public/ \ | |
# Ignore directories called "static" regardless of location | |
-not -path "*/static/*" \ | |
# Print the file paths of all files ending with any of these extensions | |
\( -name '*.png' -o -name '*.jpg' -o -name '*.jpeg' \) -print0 \ | |
# Pipe the file paths to xargs and use 8 parallel workers to process 2 arguments | |
| xargs -0 -P8 -n2 \ | |
# Tell mogrify to strip metadata, and... | |
mogrify -strip \ | |
# ...compress and resize any images larger than the target size (1000px in either dimension) | |
-thumbnail '1000>' \ | |
# Convert the files to jpg format | |
-format jpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment