Skip to content

Instantly share code, notes, and snippets.

@schluppeck
Created February 4, 2018 22:14
Show Gist options
  • Select an option

  • Save schluppeck/0e628401c91da13541bb37345ebfb76e to your computer and use it in GitHub Desktop.

Select an option

Save schluppeck/0e628401c91da13541bb37345ebfb76e to your computer and use it in GitHub Desktop.
#! /bin/bash
#
# imagemagick script for merging a texture background image
# with separate images of wands that we produced for the
# 7th birthday party of our twins
#
# 2018-02-02
# sample texture
bgTexture=TEXTURE_C.jpg
# test image
# theIM=wands/IMG_9391.jpg
# with this size
sz='2224x2983'
# for debugging, this smaller one is also good
# sz='300x400'
# run of just echo some details.
doRun=true
# loop over all wand images
for f in wands/*.jpg; do
if [[ ${doRun} == "true" ]]; then
# resize and darken the bg texture (so that merging works better)
magick \( ${bgTexture} -resize ${sz} -evaluate subtract 35% \) \
\( ${f} -rotate -90 -resize ${sz} \
-auto-level -evaluate add 7% \) \
-compose Darken_Intensity -composite \
composites/comp_$(basename ${f%%.*}).png
else
echo "only debugging ${f} for $(basename ${f}) in $(dirname ${f})"
echo "-> composites/comp_$(basename ${f%%.*}).png"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment