Last active
February 15, 2024 05:41
-
-
Save sgraessle/bbba040ece9f5943c5d1 to your computer and use it in GitHub Desktop.
Generate multiple image sizes from a directory tree.
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
#!/bin/bash | |
if [ $# -ne 2 ] | |
then | |
echo usage: $(basename $0) source_path dest_path | |
exit | |
fi | |
path=$2/$(dirname $1) | |
mkdir -p $path | |
for z in 128 256 512 | |
do | |
sips -Z $z --out $path/$(basename $1 .png)_$z.png $1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use the OS X command-line utility
sips
to generate different-sized images from a directory tree of.png
files. The new file names have sizes appended and saved to thedest_path
with similar directory structure. This needs to run from the base directory of your source tree.If you have recent
aws
installed (brew install awscli
, thenaws configure
) you can update S3 like so: