Skip to content

Instantly share code, notes, and snippets.

@MggMuggins
Created August 6, 2017 20:45
Show Gist options
  • Save MggMuggins/688c1dc22c06d7d344f11d41c2d7f71a to your computer and use it in GitHub Desktop.
Save MggMuggins/688c1dc22c06d7d344f11d41c2d7f71a to your computer and use it in GitHub Desktop.
#!/bin/bash
# USAGE:
# ./drinkOverlay /path/to/lotr/assets /path/to/output/dir
# $0 $1 $2
cd $1
cd lotr/textures/items
# Make sure we have the overlays
if [ -f $2/Overlays ]; then
echo "You need the overlays!"
exit 1
fi
# Get all of our output folders in order
if [ -f $2 ]; then
: #Do nothing...
mkdir $2
mkdir $2/Vessels
mkdir $2/Liquid
mkdir $2/LiquidBackgrounds
else
mkdir $2/Vessels
mkdir $2/Liquid
mkdir $2/LiquidBackgrounds
fi
# Grab the vessel and liquid images
allVessels=(drink_*.png)
for infile in ${allVessels[@]}; do
cp $infile $2/Vessels
done
allLiquids=(mug*_liquid.png)
for infile in ${allLiquids[@]}; do
cp $infile $2/Liquid
done
cd $2
# Remove the vessel pinkness
allVessels=(Vessels/drink_*.png)
for infile in ${allVessels[@]}; do
convert $infile -transparent 'rgba(255,0,255,100)' $infile
done
# Overlay the overlays onto the liquids, and then remove the pink
for overlay in Overlays/*; do
overlayType=${overlay#Overlays/}
overlayType=${overlayType%Overlay.png}
for liquid in Liquid/*; do
liquidType=${liquid#Liquid/mug}
liquidType=${liquidType%_liquid.png}
output="LiquidBackgrounds/$liquidType$overlayType.png"
composite -gravity center -compose Over $overlay $liquid $output
convert $output -transparent 'rgba(240,0,255,100)' $output
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment