Created
August 29, 2020 03:13
-
-
Save kamalx/314d85e04c999b50c62a55f3d4e2ab46 to your computer and use it in GitHub Desktop.
BULK GENERATING OG IMAGES -- Zach Leatherman: https://www.zachleat.com/web/bulk-og/
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
# prepare images for og serving | |
echo "Uses imagemagick." | |
images="input/*.png" | |
watermark="watermark.png" | |
outputDir="output/" | |
bgColor="#00dc9e" | |
mkdir tmp/ | |
mkdir $outputDir | |
convert "$watermark" -resize x60 -gravity center -background "transparent" "tmp/watermark.png" | |
for i in $images | |
do | |
# resize image | |
convert "$i" -resize x530 -background $bgColor -gravity center -extent 1200x630 "tmp/${i##*/}" | |
# add watermark | |
composite -gravity SouthEast -geometry +20+20 "tmp/watermark.png" "tmp/${i##*/}" "${outputDir}${i##*/}" | |
done | |
rm -rf tmp/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment